Re: Memory management (release)
Re: Memory management (release)
- Subject: Re: Memory management (release)
- From: Fritz Anderson <email@hidden>
- Date: Fri, 7 May 2004 11:54:12 -0500
First, never send the dealloc message yourself. It will be sent
automatically upon the last release of the object.
Second, the example code you show should allocate and immediately
release an NSImage. What leads you to believe it does not? An increase
in memory statistics in top or Activity Monitor is not a sure
indicator, as the malloc system might not return the image memory to
the system.
-- F
On 6 May 2004, at 6:13 PM, mic3d wrote:
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 :
[similar]
Memory don't liberate release is sended but at end of function.
Please, tell me what release don't work immediately,
--
Fritz Anderson
Consulting Programmer
http://resume.manoverboard.org/
_______________________________________________
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.