Skip navigation.
 
mlRe: memory warnings
FROM : John Stiles
DATE : Wed Mar 12 22:22:25 2008

I'm sure what you say is true. If you try to allocate right up to the
limit, yes, you will eventually hit failures.
But knowing your heap is, say, 90% full is still pretty useful
information. You can jettison stuff and try to reduce your footprint
well before you reach "the wall."

Jens Alfke wrote:
>
> On 12 Mar '08, at 11:00 AM, John Stiles wrote:
>

>> You can dive into BSD to get some values which might help you.

>
> I'm not an expert on this, but I've listened in on email threads where
> OS X kernel engineers were giving answers.
>
> Trying to preflight memory allocations is, basically, not feasible.
> Your process's address space gets fragmented, so just because X amount
> is free doesn't mean an attempt to allocate X will succeed.
>
> Going 64-bit will keep you from running out of address space. (The
> next limit you hit will probably be when the app's working set exceeds
> available physical RAM, and the system will start to thrash like
> crazy. After that, you might fill up the hard drive and run out of
> swap space, in which case you'll crash.)
>
> If the data you're manipulating comes directly from files, try to
> memory-map them instead of copying the contents into your heap. That
> can really help.
>
> —Jens

Related mailsAuthorDate
mlmemory warnings Alexander Cohen Mar 12, 18:40
mlRe: memory warnings Nick Zitzmann Mar 12, 18:53
mlRe: memory warnings John Stiles Mar 12, 19:00
mlRe: memory warnings Alexander Cohen Mar 12, 19:05
mlRe: memory warnings Jens Alfke Mar 12, 20:53
mlRe: memory warnings John Stiles Mar 12, 22:22