On 2005-09-05 13:11:18 +0100 Chris Vetter <[EMAIL PROTECTED]> wrote:
Hi there,
while testing and playing around with instance counting, I found that a
simple
void main(void)
{
NSAutoreleasePool *pool = nil;
pool = [[NSAutoreleasePool alloc] init];
{
NSObject *o;
o = [[NSObject alloc] init];
NSLog(@"--> %@", [o description]);
[o release];
}
[pool release];
exit(EXIT_SUCCESS);
}
gives me a total of 50 instances not accounted for:
../shared_obj/example: Memory leak detected: NSBundle (2), NSRecursiveLock
(2), NSUserDefaults (1), GSArrayEnumerator (35), NSLock (1),
GSArrayEnumeratorReverse (1), GSLazyRecursiveLock (3), NSFileManager (1),
GSNonretainedObjectValue (4)
Removing the NSLog(), I get no leak.
Shouldn't the autorelease pool take care of those instances?
No ... lots of objects are created and then cached for the lifetime of the
process in case they need to be re-used (bundles, locks, user defaults, file
manager, timezone, charactersets, various strings used as dictionary keys
etc).
The array enumerators are puzzling though .... I wouldn't expect to see
those after the autorelease pool is destroyed, and I don't see them when I
run the example program above.
_______________________________________________
Discuss-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/discuss-gnustep