Sunday, December 1, 2013

error for object 0xb50dd20: double free problem solving

The following sentence will cause an error in the title, trouble heroes explain, now do not understand the reason God horse, just know that deleted autorelease normal.
NSString * restName = [[[[NSString alloc] initWithString: [ItemStr substringWithRange: subPRange]] stringByReplacingOccurrencesOfString: @ "&" withString: @ "&"] autorelease];


Also found an error and solutions below. Offer:
Should've been invalidated iOS5 development errors 0 + 969 views
After iOS5 release, and quickly hands ios upgrade products, and always found a mistake can not be solved, that is "Should've benn invalidated", flash back. investigation for a long time, and finally found the file uploaded by the network, the connection lead to early release of. the release line commented out, the program normal.

leaks tool also passed the test.
Reply:
Nsstring you use stringByReplacingOccurrencesOfString this autorelease originally created, and you also add a good strange. Level is not enough to write separately, written cook themselves are confused, let alone to others to read.
Reply:
After removing autorelease here, in the back plus a [restName release] the same error, how to solve?
In front alloc, where Canadian release?

It seems that phrase really too long, but also separately,
[[NSString alloc] initWithString: [ItemStr substringWithRange: subPRange]]
This is one to add release, right.

No comments:

Post a Comment