Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

In-loop releasing of objects does not free memory?



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:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.