• 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: Simple memory problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple memory problem


  • Subject: Re: Simple memory problem
  • From: Nick Zitzmann <email@hidden>
  • Date: Thu, 5 Feb 2009 16:54:32 -0700


On Feb 5, 2009, at 4:39 PM, harry greenmonster wrote:

I'm a little confused as to why I have a problem. My understanding is that 'inputString' (on the third line) is replaced by the modified version of itself. I was expecting the memory footprint for the app to reduce in size (if anything). Obviously I have the concept fundamentally wrong in my head.

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


No. Pointers are not freed until they are deallocated, either by free() or -dealloc or the garbage collector's scanner (if GC is on) or something similar. What's probably happening is the methods you are calling are generating a bunch of temporary objects and autoreleasing them. You can create a new pool and force it to pop at any time by initializing a new NSAutoreleasePool prior to calling some methods, and then calling -drain on the pool afterwards. It's a good idea to do this in a loop in any case...

Nick Zitzmann
<http://www.chronosnet.com/>

_______________________________________________

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


References: 
 >Simple memory problem (From: harry greenmonster <email@hidden>)

  • Prev by Date: Re: Simple memory problem
  • Next by Date: Re: Needed : set class for Cocoa
  • Previous by thread: Re: Simple memory problem
  • Next by thread: Re: Simple memory problem
  • Index(es):
    • Date
    • Thread