tags:

views:

335

answers:

1

Hi.In my Iphone app I am getting:

objc[597]: FREED(id): message release sent to freed object=0x3b81780

error.What should cause this error?IS it about memory allocation? I have UITable and model view that include some text field.It takes username from model view and search this in internet and gets some images from internet.It takes data but when model view disappears app exits.and gives that error.When model views close it runs my method and gets value.But it exits from app.

+2  A: 

Basically you're trying to do something like this:

AnObject * anObject = [[AnObject alloc] init];
[anObject doSomething];
[anObject release];
[anObject doSomethingElse];

When the -release is invoked, the object is deallocated (since it only had a +1 retain count), which means your message of doSomethingElse is being sent to an object that no longer exists. You can run your app with the "Zombies" tool in Instruments to help debug this further.

Dave DeLong
+1. `doSomethingElse` == `release` in this case? (“message *release* sent to freed…”)
zoul
zoul: Yeah. Somewhere, you're releasing the object a second time. If you're not explicitly calling `release` twice, then the object is probably getting autoreleased. This is likely to happen when you use a Foundation class's convenience methods, like `stringWithFormat:`—basically, if you've got the object and don't have an `alloc` or `copy` anywhere, it's most likely been autoreleased for you.
Noah Witherspoon
I looked my program and ignored all releases.But it also gives same error.
Meko