• 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
Re: Memory Leak with NSMutable String
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory Leak with NSMutable String


  • Subject: Re: Memory Leak with NSMutable String
  • From: "Alexander F. Hartner" <email@hidden>
  • Date: Tue, 27 Jan 2004 12:19:01 +0200

Thanks guys for all your help. I do understand it much better now. The
documentation around NSAutoReleasePool was also very helpful. What I
did not understand (but do now) was that you can, and should, use
multiple NSAutoReleasePool instances, where needed. I was under the
FALSE impression that the release pool would get emptied automatically.
As I am using a FoundationTool the AutoReleasePool does not get release
periodically, which resulted in what I thought was a memory leak. From
what I have learned now, it was only the AutoReleasePool filling up
until it was being released in the application.

To address this I added another NSAutoReleasePool which I release
periodically and viola, No more excessive memory usage:

NSAutoreleasePool *subpool=[[NSAutoreleasePool alloc] init];;

for (counter=0; counter<1000000;counter++)
{
if (counter0000==0)
{
NSLog(@"CLEANUP");
[subpool release];
subpool=[[NSAutoreleasePool alloc] init];
}
doStuff();
}
[subpool release];


Thanks again
Alex
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Memory Leak with NSMutable String (From: "Alexander F. Hartner" <email@hidden>)
 >Re: Memory Leak with NSMutable String (From: Peter Maurer <email@hidden>)
 >Re: Memory Leak with NSMutable String (From: "Alexander F. Hartner" <email@hidden>)
 >Re: Memory Leak with NSMutable String (From: Chris Hanson <email@hidden>)

  • Prev by Date: Disable menu-items in dockbar
  • Next by Date: Rép : [APP IDEA] Desktop Background Scripting (Modifié par Yann Bizeul)
  • Previous by thread: Re: Memory Leak with NSMutable String
  • Next by thread: mousedown in nstextview subclass
  • Index(es):
    • Date
    • Thread