Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Hmm... malloc errors.

Hmm... malloc errors.
Thread Tools
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Feb 8, 2001, 05:09 PM
 
*** Malloc[7852]: error for object 0x5c1970: Incorrect check sum for freed object - object was probably modified after beeing freed; break at szone_error

(Cocoa, Objective-C)

Hmm... I have a similar function to the one that's giving me the errors, and that one works fine. Any ideas on what might cause this kind of error?

I'm not really freeing anything explicitly.
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Feb 8, 2001, 07:20 PM
 
Well, I've never gotten this error but my best guess would be that you autoreleased something, or appkit autoreleased something and you you used it again after it had been autoreleased. Since you aren't explicitely freeing or releasing anything that's the best that I can think of.
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Feb 9, 2001, 09:12 AM
 
I tried doing this with STDIN, STDOUT, only normal C, and cc compilation (my functions were normal C functions, not class ones)...

This error still happens.

(??)
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
Forum Regular
Join Date: Feb 2001
Location: Portland, OR, USA
Status: Offline
Reply With Quote
Feb 9, 2001, 05:20 PM
 
The mention of "object" in the error message doesn't mean object in the Obj-C sense, it is just saying the one of your malloc()ed blocks got free()d, and then something wrote into that space after the free happened and before the memory got reused.

I.e. you have a wild pointer writing into freed memory somewhere. Could you post the function that's giving you the problems? Maybe we could tell where it is coming from...
     
Mac Enthusiast
Join Date: Feb 2000
Location: Storrs,Connecticut, USA
Status: Offline
Reply With Quote
Feb 9, 2001, 07:03 PM
 
It actually keeps track of when you write to stuff that you've freed? I always thought that writing in memory that you no longer owned never generated any response (except maybe a crash) unless you ran it in malloc debug.
     
Forum Regular
Join Date: Feb 2001
Location: Portland, OR, USA
Status: Offline
Reply With Quote
Feb 11, 2001, 03:46 PM
 
Yeah, I'm surprised too. You usually only see that error if you have malloc_debug turned on. Maybe that's the default in the beta builds?
     
Admin Emeritus
Join Date: Oct 2000
Location: Boston, MA
Status: Offline
Reply With Quote
Feb 11, 2001, 05:56 PM
 
I never figured out the error: it was quicker to re-write the thing from scratch.

But the _really_ odd thing was that if I ran it under MallocDebug, it wouldn't crash, and gave no trace whatsoever of wild pointers!
"Against stupidity, the gods themselves contend in vain" (Schiller)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 12:20 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2