core dump at _malloc_unlocked

M

Martin

Hi,
I am developing a "huge" and portable software which works fine
on windows in Release/Debug Mode and on Unix in Debug Mode but crashes
when it "new" an object(GL_V5_CCM_RQRealTime_Rpy* msgBody = new
GL_V5_CCM_RQRealTime_Rpy;) in Release Mode. It is always that object
and it can crash anywhere when this object is 'new'. I got a core and
i used dbx to back trace to "_malloc_unlocked". I have used
purify(Windows) to check if there is anything wrong and i also use
"_heapchk()" in windows and everything goes fine. It seems to be
platform specific and Solaris seems to be 'stricter' and so it
crashes. I have no clue and i am checking the object time and time...
but found nothing wrong. I am sure the Solaris Machine has enough
memory. Now i recompile the software again and hope it was cause by
"Bad Compilation".
Any comments are welcome appreciated!!!!!

MC
 
A

Attila Feher

Martin said:
Hi,
I am developing a "huge" and portable software which works fine
on windows in Release/Debug Mode and on Unix in Debug Mode but crashes
when it "new" an object(GL_V5_CCM_RQRealTime_Rpy* msgBody = new
GL_V5_CCM_RQRealTime_Rpy;) in Release Mode. It is always that object
and it can crash anywhere when this object is 'new'. I got a core and
i used dbx to back trace to "_malloc_unlocked". I have used
purify(Windows) to check if there is anything wrong and i also use
"_heapchk()" in windows and everything goes fine. It seems to be
platform specific and Solaris seems to be 'stricter' and so it
crashes. I have no clue and i am checking the object time and time...
but found nothing wrong. I am sure the Solaris Machine has enough
memory. Now i recompile the software again and hope it was cause by
"Bad Compilation".
Any comments are welcome appreciated!!!!!

Check OS patches (esp. ones required by the compiler or recommended by Sun).
Also on Solaris this very crash usually happens if you have "double deleted"
something. Try using the memory checking libraries.
 
K

Kevin Goodsell

Martin said:
Hi,
I am developing a "huge" and portable software which works fine
on windows in Release/Debug Mode and on Unix in Debug Mode but crashes
when it "new" an object(GL_V5_CCM_RQRealTime_Rpy* msgBody = new
GL_V5_CCM_RQRealTime_Rpy;) in Release Mode. It is always that object
and it can crash anywhere when this object is 'new'. I got a core and
i used dbx to back trace to "_malloc_unlocked". I have used
purify(Windows) to check if there is anything wrong and i also use
"_heapchk()" in windows and everything goes fine. It seems to be
platform specific and Solaris seems to be 'stricter' and so it
crashes. I have no clue and i am checking the object time and time...
but found nothing wrong. I am sure the Solaris Machine has enough
memory. Now i recompile the software again and hope it was cause by
"Bad Compilation".
Any comments are welcome appreciated!!!!!

You have probably corrupted the dynamic memory system by writing to
memory that you didn't own, or some other form of undefined behavior,
regardless of what purify thinks. (By the way, why are you trying to
debug the problem on the system it works on? Wouldn't it make more sense
to track the problem on the system where the problem occurs?)

There's not much we can say other than good luck. And code more
carefully next time.

By the way, in modern C++ you shouldn't need to use 'new' all that
often, and when you do it's probably best to use a smart pointer instead
of a regular pointer. Avoiding unnecessary low-level memory management
is a good way to reduce bugs.

-Kevin
 
Joined
Nov 18, 2008
Messages
1
Reaction score
0
Hello Martin,

We are also facing a similar issue on our Solaris box. Our code works in debug mode but crashes in the release mode. We think that our issue is system specific as we are not able to reproduce the issue on our test servers.

Do you have any solution of the issue mentioned in the mail thread? Any help would be highly appreciated.

Thanks and regards,
Hitesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top