• 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
In-loop releasing of objects does not free memory?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

In-loop releasing of objects does not free memory?


  • Subject: In-loop releasing of objects does not free memory?
  • From: Arthur C. <email@hidden>
  • Date: Tue, 12 Feb 2008 23:10:16 +0100
  • Importance: Normal

I am writing a Cocoa-program to reduce a large amount of measurement data.
This involves reading in large files, like 6 MB each, in a loop over about 60 of them.
I try to release as many temporary objects as possible whenever I'm finished with them. However, the memory is not freed, as can be seen using Activity monitor, and by a dramatic slowdown due to memory overflow.

So the question is, how can I get the memory back? I need it for the next file(s)...

Code looks like this:

NSArray * files; // contains a list of filenames
for(i=0;i<[files count]; i++)
{
   NSString * dataFromFile = [[NSString alloc] initWithContentsOfFile: [files objectAtIndex: i]];
   < some processing >
   [dataFromFile release];
}

Autoreleased instances behave the same, i.e. no memory gets really freed.


Thanks for your time,

Arthur C.
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/_______________________________________________

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: In-loop releasing of objects does not free memory?
      • From: John Terranova <email@hidden>
    • Re: In-loop releasing of objects does not free memory?
      • From: j o a r <email@hidden>
  • Prev by Date: Re: KVC and KVO for arrays
  • Next by Date: Re: NSView -drawRect optimization
  • Previous by thread: Re: NSView -drawRect optimization
  • Next by thread: Re: In-loop releasing of objects does not free memory?
  • Index(es):
    • Date
    • Thread