I have an application in which i have some videos and audios and some inapp purchases.all r great in simulator and working perfectly.But yesterday i have created an application and trying to run on it its crashing from the begning.The error report is
malloc: *** error for object 0x165060: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
can anybody knows the solution .i dont know where it is going wrong and in simulator it is working perfectly.can anybody help me?
I followed as talkol suggested
In my case I replaced following line
[myMutualArray removeAllObjects];
with
[myMutualArray removeAllObjects]; myMutualArray = nil;
And the error gone!
You are probably releasing an object too many times (for example, calling alloc once and release twice). To find out where, take a look at the techniques in this question: How to find the cause of a malloc "double free" error?
I personally like the NSZombieEnabled
method.
Another tip, is to set your variables to nil after you release them.
For example: [bla release]; bla = nil;
This makes sure you will not accidentally release them twice since releasing nil
does nothing.
Please test the program for memory leaks,also check autoreleases and whether you are releasing objects properly or not.Also we need to check whether a released object has a memory allocated or not.You also need to be careful regarding autorelease,because accidentally we might release an array or a string or any object that is already autoreleased...
Here are some of the tips to trace out the exact problem:
You can test for leaks by analyzing your project(click shift+command+k)
Use instruments tool i.e. running for leaks
Enable NSZombie in Xcode,procedure can be found here
Hope it helps and works!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With