• 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 Auto-Increasing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Memory Auto-Increasing


  • Subject: Re: Memory Auto-Increasing
  • From: Sherm Pendley <email@hidden>
  • Date: Sat, 1 Jun 2002 16:28:52 -0400

On Saturday, June 1, 2002, at 12:56 PM, Lorenzo Puleo wrote:

My application, while a recursive routine is running, increases its
"Resident Memory Size" and its "Virtual Memory Size". I saw this using
ProcessViewer utitlity. Sincerely I don't know what is causing that.

I don't see any obvious leaks in your code, but recursion can be very memory intensive even without leaks.

Local variables are allocated on a stack. The classic example of a stack is a stack of dishes. When a plate is added, it sits on the top of the stack. When a plate is removed, it is taken from the top of the stack. Each time a method is called, a new set of plates (local variables) is created and added to the top of the stack. When the method returns, the plates that belong to it (its local variables) are taken off the top of the stack.

When recursion is used, local variables for each recursive method call are allocated and placed on top of the stack, over top of any existing variables belonging to previous calls to that method. So, the stack grows until the maximum depth of nested method calls is reached. At that point, as nested method calls begin returning back up towards the first, the stack shrinks as each return removes its local variables from the stack.

Hope this helps!

sherm--

Never put off until tomorrow what you can do today. There might be a law against it by that time.
_______________________________________________
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 Auto-Increasing (From: Lorenzo Puleo <email@hidden>)

  • Prev by Date: Re: URL friendly NSString?
  • Next by Date: Re: isa
  • Previous by thread: Memory Auto-Increasing
  • Next by thread: Protecting Open Source
  • Index(es):
    • Date
    • Thread