Red Hat Bugzilla – Bug 98663
How to increase the Stack size and Data size for C codes to run in gcc in LInux
Last modified: 2005-10-31 17:00:50 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030225
Description of problem:
I am using the LINUX 9 and gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
I am some C codes and linked these code to form a shared object as libqpt.so.
Now i use this SO file and run the main file which has large arrays declared for
the worspace and others etc. when i run the code i get segmentation fault due to
variables declared are cossing the data segment and the stack size. Hence i
modified my code and used the malloc for those arrays used. I got partial output
and segmentation fault occurs again.
Please anybody can hep me out to increase the stack size as we can do in the
Visual Studio. Note i have no IDE i am running the code in the terminal. Please
do giv me any possible solutions for the problem. My thanks in early.
Mail the solution to me at: email@example.com
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1.there are no special setups i just run the code using the command:
gcc -rdynamic -L./ -lqpt -lm -o qpmain qpmain.c
output i get is:
Actual Results: i obtained the partial output in the output file and later same
result segmentation fault is faced.
Expected Results: an output file has to be generated.
You can tweak the limits with ulimit(1) or setrlimit(2).
Sometimes if the allocations are really huge statically linking helps as well, or going for a 64-bit CPU.
But, bugzilla is certainly not a help forum, you should try mailing lists.