CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2003
    Location
    London, UK
    Posts
    23

    Tracing a memory error on unix

    Hi there,
    I hope this is not a too general question. I have a reasonable large program and recently when I run it I get the following errors:

    *** malloc[566]: error for object 0x1f2cb0: Incorrect checksum for freed object - object was probably modified after being freed; break at szone_error

    Program received signal EXC_BAD_ACCESS, Could not access memory.
    0x900042a8 in free_list_remove_ptr ()

    Now i have no idea how to trace this back to its source. I am using gcc 3.1 on Mac OS X. I have tried doing a backtrace in gdb but the thing that is points to is clearing a valarray which i have had no problem with previously.

    Any hints would be appreciated,

    Dan

    PS Here is the backtrace:
    Attached Files Attached Files

  2. #2
    Join Date
    Jul 2012
    Posts
    1

    Re: Tracing a memory error on unix

    Hi

    I have similar error bothering me. Somewhere when I run code it will give me this following memory error. Couldnt find the proper reason to solve it.
    *** malloc[566]: error for object 0x1f2cb0: Incorrect checksum for freed object - object was probably modified after being freed; break at szone_error

    Program received signal EXC_BAD_ACCESS, Could not access memory.


    Any help would be appriciated.

    Thanks

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: Tracing a memory error on unix

    Quote Originally Posted by PrAnu0709 View Post
    Hi

    I have similar error bothering me. Somewhere when I run code it will give me this following memory error. Couldnt find the proper reason to solve it.
    *** malloc[566]: error for object 0x1f2cb0: Incorrect checksum for freed object - object was probably modified after being freed; break at szone_error
    When you corrupt memory, anything can happen, including having your program "work".

    Unlike other computer languages, C and C++ do not guarantee how your program will behave when you make mistakes like this -- it may work today and crash tomorrow.
    Couldnt find the proper reason to solve it.
    The reason it happens is you have mismanaged the heap functions (malloc and free) and corrupted the heap. Needless to say, you need to debug your code.

    Regards,

    Paul McKenzie
    Last edited by Paul McKenzie; July 19th, 2012 at 04:32 AM.

  4. #4
    Join Date
    Jul 2007
    Posts
    249

    Re: Tracing a memory error on unix

    Use valgrind to find out the memory leaks and invalid read/write problems.

    It is really helpful in finding the memory corruptions and leaks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured