Strange malloc Error
Mon Aug 29 00:17:00 GMT 2005
I have a strange error. Can you please help me solve it or at
least direct me to a good forum?
Using SUSE 9.3
Athlon 32bit 700Mhz
The error is in C++ code. Essentially I am getting
segmentation faults on cals tol malloc(). It's not all malloc calls.
In fact I call malloc a lot in this program it's just this one.
As a test I used a for loop to call malloc and free with
increasing memory size. At a certain limit it crashes. So I figured
its a memory limitation.
I have used "getrlimit" to get stack limit, address limit and
data limit. In all three cases I get infinity on the soft and hard
limits. When I get the usage the "getrusage(RUSAGE_SELF, &usage)"
(oddly) shows 0 on both data and stack usage.
I tried to modify my code to not call malloc. However I get
the same error on the previous malloc call. That is the really strange
thing. I try to write out malloc calls to reduce memory requirments
but the segmentation error migrates to the previous malloc. That
malloc is in the calling function!!! so the stack is even smaller!!!
It is as if my program is destined to fail on some malloc call.
So if there is any expert that has any idea what is going on
please tell me?!?!
More information about the Gcc-help