![]() | InDesign SDK 20.5 |
#include <IMemoryManager.h>

Public Types | |
| enum | { kDefaultIID = IID_IMEMORYMANAGER } |
| enum | PurgeLevel { kNoPurge = -1, kSwitchingDocuments = 0, kSwitchingApplications = 1, kLowMemory1 = 2, kLowMemory2 = 3, kLowMemory3 = 4, kReleaseEverything = 5, kMaxMemoryLevel = 5 } |
| enum | MemoryState { kNormalMemoryState = 0, kConstrainedMemoryState = 1, kLowMemoryState = 2 } |
Public Member Functions | |
| virtual void | Init ()=0 |
| virtual void | PurgeObjects (PurgeLevel purgeLevel)=0 |
| virtual void | CheckMemoryState ()=0 |
| virtual bool16 | MemoryPanic ()=0 |
| virtual bool16 | CheckMemory (bool16 showAlerts=kFalse)=0 |
| virtual bool16 | MemoryIsLow ()=0 |
| virtual bool16 | MemoryIsFailing ()=0 |
| virtual void | RegisterAdviseMemoryStateNotification (AdviseMemoryStateNotificationFunction func, void *refPtr)=0 |
| virtual void | UnregisterAdviseMemoryStateNotification (AdviseMemoryStateNotificationFunction func, void *refPtr)=0 |
| virtual uint32 | GetPurgeCount () const =0 |
| virtual uint32 | GetPurgeTime () const =0 |
| virtual bool16 | PurgeInProgress () const =0 |
| virtual bool16 | HandleAllocationFailure (size_t blockSize)=0 |
| virtual void | ResetFailureHandler ()=0 |
Register and de-register purge handlers | |
| virtual void | RegisterMemoryNotification (MemoryNotificationFunction func, void *refPtr)=0 |
| virtual void | RegisterNewMemoryNotification (NewMemoryNotificationFunction func, void *refPtr, bool16 bGrowZoneFailSafe)=0 |
| virtual void | UnregisterMemoryNotification (MemoryNotificationFunction func, void *refPtr)=0 |
| virtual void | UnregisterNewMemoryNotification (NewMemoryNotificationFunction func, void *refPtr)=0 |
Public Member Functions inherited from IPMUnknown | |
| virtual IPMUnknown * | QueryInterface (PMIID interfaceID) const =0 |
| virtual void | AddRef () const =0 |
| virtual void | Release () const =0 |
The memory manager keeps track of the memory load, and acts as a central handler for memory issues.
Every purge request has a priority attached to it, which is the PurgeLevel.
| pure virtual |
If CheckMemory() returns kFalse the application should quit asap.
| pure virtual |
Checks available memory and notifies registered memory state clients so thay can make caching algorithm adjustments.
| pure virtual |
Return the number of times PurgeObjects has been called
| pure virtual |
Returns the cumulative time spent in PurgeObjects
| pure virtual |
Called when an allocation fails. It will attempt to free some memory by calling the purge handlers. Returns true if it made any progress and the caller should retry the allocation, false if no progress was made and we should give up.
| blockSize | [IN] - the size of the block that the allocator failed to allocate. |
| pure virtual |
If MemoryIsFailing() returns kTrue the application should quit asap
| pure virtual |
If MemoryIsLow returns kTrue certain methods and commands will not work.
| pure virtual |
Tries to free the last memory reserves. The memory manager maintains a reserve emergency block of memory that can be freed in order to satisfy memory requests when all other attempts have failed. These blocks will be reacquired as soon as the application judges the memory state has improved.
| pure virtual |
Returns true if a memory purge is in progress for the calling thread. Note that the function can return false, but other threads can be purging. Reserved for internal use only.
| pure virtual |
Tries to free some memory. Calls out to the purge handlers and requests them to free up memory. PurgeObjects is called by the new fail handler.
| purgeLevel,the | priority level of the request |
| pure virtual |
Register a memory state notification function.
| func | the memory state notification function to register |
| refPtr | the pointer to pass the function when it's called |
| pure virtual |
Register a purge handler.
| func | the memory notification function to register |
| refPtr | the pointer to pass the function when it's called |
| pure virtual |
Register a purge handler.
| func | the memory notification function to register |
| refPtr | the pointer to pass the function when it's called |
| pure virtual |
Resets the failure handler into its initial state. Called after the failure handler was invoked (one or more times) in order to reset the purge level back to normal. Reserved for internal use only.
| pure virtual |
De-register a memory state notification function.
| func | the memory state notification function to de-register |
| refPtr | the pointer to pass the function when it's called |
| pure virtual |
De-register a purge handler.
| func | the memory notification function to register |
| refPtr | the pointer to pass the function when it's called |
| pure virtual |
De-register a purge handler.
| func | the memory notification function to register |
| refPtr | the pointer to pass the function when it's called |