On 6 Feb 2009, at 10:39 am, harry greenmonster wrote:

a pointer address when replaced by another address free's up the old memory location it once pointed to, no?

No.

It just means you orphaned the object - the memory it occupies is still err, occupied. However, in this case it's OK to do that in theory because the string returned by -stringByReplacingCharacters... is autoreleased, meaning that at some point the autorelease pool will be drained, cleaning it up. But for strings 5Mb long, you have a problem.

The question is, at what point? Certainly not within this while loop, and that's why your footprint is growing.

So, try this:

while( ... )
{
        NSAutoreleasePool* pool = [NSAutoreleasePool new];

        // ...do your thing...



        [pool drain];
}



hth,

--Graham


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to