Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I "check before making a memory request"?




Scott Fraser wrote:

In the header "MacMemory.h", and in the documentation for MemError, it
says in part:

"Instead of relying on MemError(), check before making a memory request
that there is enough memory both to fulfill the request and to support
essential operations."


My old app caches LOTS of data to improve performance, several
gigabytes worth at a time. It is quite likely to (and does) run out of
VM, let alone real memory. However, it's very easy for me to release
these caches if I know to do so. What is the recommended way to check
that there is "enough" memory left? The only obvious (or documented)
way of checking memory is to try to allocate some, which gets expensive
if I have to allocate memory twice for each block of interest. Then
there is the old tried and true method of hanging on to a really large
block, and freeing that before walking my cache, so I don't fail while
doing even that.

FreeVM() and MaxVBlock() <http://lists.apple.com/archives/Carbon-dev/2005/Jan/msg01202.html>

Robert P.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.