Autorelease pool
Autorelease pool
- Subject: Autorelease pool
- From: Michael Süssner <email@hidden>
- Date: Wed, 7 Oct 2009 23:53:25 +0200
I habe created a small shell programm using Cocoa Foundation class for
test purposes.
After my test program has passed successfully the drain method of the
autorelease buffer is called and "sometimes" I get the following error:
Program received signal: “EXC_BAD_ACCESS”.
sharedlibrary apply-load-rules all
How can I track which object has already been release:
The code is rather simple:
void printPolygonInfo()
{
PolygonShape * vPolygon;
NSString *str;
int i;
NSArray *vPolyArray = [NSArray arrayWithObjects:
[[PolygonShape alloc] initWithNumberOfSides:4
minimumNumberOfSides:3 maximumNumberOfSides:7],
[[PolygonShape alloc] initWithNumberOfSides:6
minimumNumberOfSides:5 maximumNumberOfSides:9],
[[PolygonShape alloc] initWithNumberOfSides:11
minimumNumberOfSides:9 maximumNumberOfSides:12],
nil];
for (vPolygon in vPolyArray){
NSLog(@"%@\n Retain Count:%d",[vPolygon description], [vPolygon
retainCount]);
}
NSLog(@"Try to set number of sides equal 10\n\n");
for (vPolygon in vPolyArray){
vPolygon.numberOfSides = 10;
}
[vPolyArray release];
}
When I delete the NSLog line, then the code seems to run fine. Even
the retaincount is 2, so??
Any suggestions?
Michael
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden