• 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
subpathsAtPath and memory usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

subpathsAtPath and memory usage


  • Subject: subpathsAtPath and memory usage
  • From: email@hidden
  • Date: Wed, 22 Aug 2007 22:19:55 +0200

Hi,

I have an NSFileManager / memory usage question. I have searched the archives, the Cocoadev wiki and other sites but I can't seem to find the answer.

In my app I'm using NSFileManager's subpathsAtPath call and this works fine. However, when working with large directory structures (e.g. my Home folder), this takes a lot of memory. This is probably normal, but what puzzles me is that the memory is retained even when the method has reached the end and all objects should have been released. For example, for my Home folder the method below builds up memory usage from about 30 MB to 650 MB. Even long after the method below is completed, the memory usage remains at 650 MB.

This is what I'm doing:

- (IBAction)testMemory:(id)sender;
{
// NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSArray *children = [[NSFileManager defaultManager] subpathsAtPath:@"/Users/myUserName/"];
// [pool release];
NSLog(@"Done!");
}


As can be seen from the code above, I even tried to create and release my own NSAutoreleasePool but this has no effect. The memory for my app builds up to 650 MB after this call and remains at that level, long after everything should have been (auto)released. I tried the same thing with the enumeratorAtPath approach but this has the same effect.

Is there anything that can be done to avoid this. I guess the problem might be that [NSFileManager defaultManager] does not release its memory and since the object is a singleton, it stays alive as long as my app lives.

Any suggestions on how to reclaim the memory that has been consumed by this call would be much appreciated!

Peter
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: subpathsAtPath and memory usage
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Re: Detect legacy OSX
  • Next by Date: Re: Re:
  • Previous by thread: Re: Xcode 2.5 - What's different?
  • Next by thread: Re: subpathsAtPath and memory usage
  • Index(es):
    • Date
    • Thread