• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Memory management (release)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


References: 
 >Memory management (release) (From: mic3d <email@hidden>)

  • Prev by Date: Re: The Cell from Hell (TM)
  • Next by Date: Re: Hard disk partition name
  • Previous by thread: Memory management (release)
  • Next by thread: Hard disk partition name
  • Index(es):
    • Date
    • Thread