In-loop releasing of objects does not free memory?
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