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.