Memory management (release)
Memory management (release)
- Subject: Memory management (release)
- From: mic3d <email@hidden>
- Date: Fri, 7 May 2004 01:13:24 +0200
Hi,
I am new on this list, I have question about memory release in
objective - c ;-)
In this code :
NSArray *array=[[NSFileManager defaultManager]
directoryContentsAtPath:path];
NSEnumerator *e=[array objectEnumerator];
NSString *item;
while (item=[e nextObject])
{
NSImage *img=[[NSImage alloc] initWithContentsOfFile:[path
stringByAppendingPathComponent:item]];
[img release]; // or [img dealloc]
}
OR :
NSString *path=[@"~/Pictures/Fonds d'icran/"
stringByExpandingTildeInPath];
NSArray *array=[[NSFileManager defaultManager]
directoryContentsAtPath:path];
NSEnumerator *e=[array objectEnumerator];
NSString *item;
while (item=[e nextObject])
{
[self loadPict:[path stringByAppendingPathComponent:item]];
}
- (void)loadPicture:(NSSring*)path
{
NSImage *img=[[NSImage alloc] initWithContentsOfFile:path];
[img release]; // ou [img dealloc]
}
Memory don't liberate release is sended but at end of function.
Please, tell me what release don't work immediately,
Thanks,
Michakl Parrot.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.