core dump at _malloc_unlocked

Discussion in 'C++' started by Martin, Aug 25, 2003.

  1. Martin

    Martin Guest

    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
    Martin, Aug 25, 2003
    #1
    1. Advertising

  2. Martin

    Attila Feher Guest

    [OT]Re: core dump at _malloc_unlocked

    Martin wrote:
    > 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.

    --
    Attila aka WW
    Attila Feher, Aug 25, 2003
    #2
    1. Advertising

  3. Martin wrote:

    > 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
    --
    My email address is valid, but changes periodically.
    To contact me please use the address from a recent posting.
    Kevin Goodsell, Aug 25, 2003
    #3
  4. Martin

    hitbandil

    Joined:
    Nov 18, 2008
    Messages:
    1
    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
    hitbandil, Nov 18, 2008
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike
    Replies:
    0
    Views:
    706
  2. BlueDoze
    Replies:
    2
    Views:
    1,112
    Gordon Beaton
    May 4, 2004
  3. Amit
    Replies:
    0
    Views:
    969
  4. halfdog
    Replies:
    12
    Views:
    12,433
  5. Martin

    core dump at _malloc_unlocked

    Martin, Aug 25, 2003, in forum: C Programming
    Replies:
    1
    Views:
    510
    Joona I Palaste
    Aug 25, 2003
Loading...

Share This Page