|
-
March 31st, 2008, 09:23 AM
#1
segfault from C stack overflow
Hi All,
I have made an web application using perl/cgi ,R and C. It processess huge chunk of data.
Now when the data size is too big . I am getting this error
Error: segfault from C stack overflow
There were 18 warnings (use warnings() to see them)
Error: C stack usage is too close to the limit
Execution halted
Can you please suggest how to overcome this problem or how to increase the stack size.
Any suggestion will be a help as I have no clue.
thanks in advance
-
March 31st, 2008, 09:39 AM
#2
Re: segfault from C stack overflow
 Originally Posted by vidhu
Any suggestion will be a help as I have no clue.
thanks in advance
If you're making recursive calls, make them iterative, not recursive.
If you're declaring large local variables, either make them global or create them dynamically.
If you're making too many levels of function calls, review your design.
Increasing the stack should not be an option until you discover exactly why you get the stack overflow, and then you should attempt to remedy the problem programatically.
Regards,
Paul McKenzie
-
March 31st, 2008, 09:59 AM
#3
Re: segfault from C stack overflow
Thanks for the reply.
I cannot change the code as It is internally calling one of the functions of R BioHMM library
and I am getting the error from the function called
-
March 31st, 2008, 10:17 AM
#4
Re: segfault from C stack overflow
Don't be so quick to assume the problem isn't your fault. Just because the actual error happens in 3rd-party code doesn't mean yours isn't responsible.
If, for instance, your own code used up all the stack space and this other call put it over the edge, that would be your problem.
-
March 31st, 2008, 10:39 AM
#5
Re: segfault from C stack overflow
 Originally Posted by Paul McKenzie
Increasing the stack should not be an option until you discover exactly why you get the stack overflow, and then you should attempt to remedy the problem programatically.
Wondering how can we increase the stack size assigned to our program?
Regards
sris kanagasabai
-
March 31st, 2008, 11:01 AM
#6
Re: segfault from C stack overflow
 Originally Posted by vidhu
Thanks for the reply.
I cannot change the code as It is internally calling one of the functions of R BioHMM library
and I am getting the error from the function called
See this code:
Code:
int main()
{
double x[10000000];
CallThirdParty(x);
}
What if declaring the array x used up all of the stack, and just calling the third party code creates the error? The fault is yours, not the third-party code.
Regards,
Paul McKenzie
-
March 31st, 2008, 05:54 PM
#7
Re: segfault from C stack overflow
 Originally Posted by skanthaverl
Wondering how can we increase the stack size assigned to our program?
Read the compiler documentation. Different compilers and operating systems will have different methods of configuring the application. I'm not suggesting you do that, but there is no C++ answer to that question. It requires extensive knowledge of the system you are writing the program for, especially if it is an embedded application.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|