• 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 allocation and virtual memory increase
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: memory allocation and virtual memory increase


  • Subject: Re: memory allocation and virtual memory increase
  • From: Bill Bumgarner <email@hidden>
  • Date: Tue, 28 Nov 2006 08:27:00 -0800

On Nov 28, 2006, at 7:54 AM, Shawn Erickson wrote:
I'm not sure I completely agree with your recommendation of recycling buffers here. In my experience, unless an app is doing hundreds of allocations and frees per second, there isn't a strong need for pooling buffers. Malloc basically /is/ a buffer pooling system, and it's darn fast on OS X, so unless you have special needs and malloc isn't cutting it for you, why reinvent that wheel?

Well if they are large buffers (OP didn't say) then reallocating them can fragment the processes virtual memory space as the large buffers intermix with other allocations. It could result in not having a large enough contiguous virtual memory range to reallocate one of the buffers after some cycles.


Of course I don't think that is happening (not easy to do... unless dealing with rather large buffers and/or much memory allocation in between)... I think he is hitting some type of memory leak or some other type of crash in his code that he is incorrectly linking with having a large virtual memory space allocated.

Yes -- to be utterly clear -- I don't think his app is fragmenting the heap so badly that it is running out of address space, either. Until the leak is fixed, any optimizations are premature.


Once the leak is fixed, then performance analysis may indicate that the constant malloc()/free() pattern is both a CPU hog and/or artificially inflating the address space of the app by some percentage.

b.bum
_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: 
 >memory allocation and virtual memory increase (From: "Bruce Johnson" <email@hidden>)
 >Re: memory allocation and virtual memory increase (From: Bill Bumgarner <email@hidden>)
 >Re: memory allocation and virtual memory increase (From: John Stiles <email@hidden>)
 >Re: memory allocation and virtual memory increase (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Slightly OT: SIGKILL (force quit) and child process termination
  • Next by Date: Re: Slightly OT: SIGKILL (force quit) and child process termination
  • Previous by thread: Re: memory allocation and virtual memory increase
  • Next by thread: Re: Re: memory allocation and virtual memory increase
  • Index(es):
    • Date
    • Thread