You are currently viewing a snapshot of www.mozilla.org taken on April 21, 2008. Most of this content is highly out of date (some pages haven't been updated since the project began in 1998) and exists for historical purposes only. If there are any pages on this archive site that you think should be added back to www.mozilla.org, please file a bug.
A client that wishes to be notified of low memory situations (for example, because the client maintains a large memory cache that could be released when memory is tight) should register with the observer service (see
nsIObserverService) using the topic memory-pressure. There are three specific types of notications that can occur. These types will be passed as the
aDataparameter of the "memory-pressure" notification:low-memory: This will be passed as the extra data when the pressure observer is being asked to flush for low-memory conditions.
heap-minimize: This will be passed as the extra data when the pressure observer is being asked to flush because of a heap minimize call.
alloc-failure: This will be passed as the extra data when the pressure observer has been asked to flush because a
null, this function behaves like
sis the size of the block to which
ptrpoints, the first
min(s, size)bytes of
ptr's block are copied to the new block. If the allocation succeeds,
ptris freed and a pointer to the new block returned. If the allocation fails,
ptris not freed and
nullis returned. The returned value may be the same as
immediate:If the value is
TRUE, heap minimization will occur immediately if the call was made on the main thread. If the value is
FALSE, the flush will be scheduled to happen when the app is idle.
| Written by:Ellen Evans | Comments, questions, complaints?