PDA

View Full Version : broken object


Feanor
2002.05.27, 10:40 AM
*** malloc[9869]: error for object 0x1d6d000: Incorrect check sum for freed object - object was probably modified after beeing freed; break at szone_error


What does that error really mean? I'm running a test on an Obj-C class which is meant to hold dynamically allocated arrays of floats (for verts and such). The error happens here:

- (IBAction)makeBox: (id)sender
{
aBox = [[BJGBoxGeometry alloc] init];

if( aBox ) {
[status setStringValue: @"a box has been created" ];
[sender setEnabled: NO];
[deleteButton setEnabled: YES];
[resizeButton setEnabled: YES];
}


The error doesn't happen if I use another object instead of BJGBoxGeometry (say, NSString or BJGGeometry, the direct superclass). ((Smilie problem fixed.))

b

Josh
2002.05.27, 11:49 AM
You may want to post again with smilies disabled. I HATE how they deform code...

rangaroek
2002.06.04, 10:17 AM
Originally posted by Feanor
*** malloc[9869]: error for object 0x1d6d000: Incorrect check sum for freed object - object was probably modified after beeing freed; break at szone_error


What does that error really mean? I'm running a test on an Obj-C class which is meant to hold dynamically allocated arrays of floats (for verts and such). The error happens here:

- (IBAction)makeBox: (id)sender
{
aBox = [[BJGBoxGeometry alloc] init];

if( aBox ) {
[status setStringValue: @"a box has been created" ];
[sender setEnabled: NO];
[deleteButton setEnabled: YES];
[resizeButton setEnabled: YES];
}


... snip ...


Hi, use gdb to find the exact line in your code which crashes...
(set a breakpoint on the first line)

What kind of class is the super of BJGBoxGeometry ... ???

adios, rangaroek

Feanor
2002.06.04, 01:57 PM
Heh, I found my problem -- nothing to do with objects at all. I had a mismatch between the pointer type cast coming back from malloc and the sizeof(type) used to calculate the memory needed. That's what happens when you cut and paste code.

B