Reputation: 11
I get an error
malloc: *** error for object 0x146f9404: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
in the following method :
+ (void)drawXIB_StatsDetaillees:(Statistiques*)statistiques ... {
NSArray* objects = [[NSBundle mainBundle] loadNibNamed:@"Match_Statistiques_Detaillees" owner:self options:nil];
The error comes with the NSArray.
Here is the call of this method :
+ (NSString*)drawPDF:(Match*)currentMatch {
[self drawXIB_StatsDetaillees:[currentMatch statistiquesMatch] andMatch:currentMatch andTitre1:titre1 andTitre2:titre2];
It's a static class called through a new thread (GCD), and i think that my NSArray is released between 2 calls of this class.
Do you agree with that ?
In this case, should i create a property with strong attribute for my array instead of create a new instance at each call ?
Thanks for your help and excuse me if my english is bad.
Stephane
Upvotes: 1
Views: 766
Reputation: 1195
You are getting the error in that method but the problem is elsewhere.
To find the source of the problem, in XCode go to Product > Scheme > Edit Scheme, and under Diagnostics tab enable all the Malloc settings and Guard Malloc.
With that, run your application again, and XCode will stop at the line causing the problem.
Upvotes: 1