• 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
Memory management (release)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • Re: Memory management (release)
      • From: Fritz Anderson <email@hidden>
  • Prev by Date: Max Width of a RTF text
  • Next by Date: Re: User defaults not setting...
  • Previous by thread: Re: Max Width of a RTF text
  • Next by thread: Re: Memory management (release)
  • Index(es):
    • Date
    • Thread