MemoryManager Class Reference

class MemoryManager
A class handles all memory operations and OOM issues memman.lib
Since
3.1
Public Member Functions
IMPORT_C void AddCollector ( MMemoryCollector *)
IMPORT_C void AddStopper ( MOOMStopper *)
IMPORT_C void CloseFastAllocator ( RAllocator *)
IMPORT_C void CreateFastAllocator ()
IMPORT_C void FreeRam ()
IMPORT_C void InitFastAllocator ()
IMPORT_C void InitOOMDialog ()
IMPORT_C TUint MemorySize ( TAny *)
IMPORT_C TUint PostCheck ()
IMPORT_C TBool PreCheck ( TUint , TUint , const TDesC8 &)
IMPORT_C void PrepareForExit ()
IMPORT_C void RemoveCollector ( MMemoryCollector *)
IMPORT_C void RemoveStopper ( MOOMStopper *)
IMPORT_C void ResetOOMDialogDisplayed ()
IMPORT_C void RestoreCollectors ()
IMPORT_C void SetNotifier ( MOOMNotifier *)
IMPORT_C void SetRescueBufferSize ( TInt )
IMPORT_C void SetStatus ( TOOMCheckResult )
IMPORT_C TUint Status ()
IMPORT_C RAllocator * SwitchToFastAllocator ()

Member Functions Documentation

AddCollector(MMemoryCollector *)

IMPORT_C void AddCollector ( MMemoryCollector * aCollector ) [static]
register a memory collector, memory manager doesn't own this collector
Since
3.1

Parameters

MMemoryCollector * aCollector the collector to be registered

AddStopper(MOOMStopper *)

IMPORT_C void AddStopper ( MOOMStopper * aStopper ) [static]
register a stopper, memory manager doesn't own this stopper.
Since
3.1

Parameters

MOOMStopper * aStopper the stopper to be registered

CloseFastAllocator(RAllocator *)

IMPORT_C void CloseFastAllocator ( RAllocator * aDefaultAllocator ) [static]
switch to the default allocator provided by Symbian OS, and close the current fast allocator.
Since
3.1

Parameters

RAllocator * aDefaultAllocator

CreateFastAllocator()

IMPORT_C void CreateFastAllocator ( ) [static]

Create fast allocator and switch as default heap. Special case if fast allocator has to be created from SetupThreadHeap().

Since
9.2

FreeRam()

IMPORT_C void FreeRam ( ) [static]
Free some RAM. Calls collect on registered collectors
Since
3.1

InitFastAllocator()

IMPORT_C void InitFastAllocator ( ) [static]

Initialize MemoryManager library. Special case if CreateFastAllocator is called from SetupThreadHeap().

Since
9.2

InitOOMDialog()

IMPORT_C void InitOOMDialog ( ) [static]
initialize the OOM handler in the memorypool
Since
9.2

MemorySize(TAny *)

IMPORT_C TUint MemorySize ( TAny * aPtr ) [static]
retrieve the size of an allocated memory cell
Since
3.1

Parameters

TAny * aPtr

PostCheck()

IMPORT_C TUint PostCheck ( ) [static]
An additional check after an operation is completed.
Since
3.1

PreCheck(TUint, TUint, const TDesC8 &)

IMPORT_C TBool PreCheck ( TUint aTotalSize,
TUint aMaxBufSize,
const TDesC8 & aChecker =  KNullDesC8
) [static]
check if the memory manager is able to reserve enough memory for the coming operation.
Since
3.1

Parameters

TUint aTotalSize total amount of memory
TUint aMaxBufSize
const TDesC8 & aChecker =  KNullDesC8 the name of operation

PrepareForExit()

IMPORT_C void PrepareForExit ( ) [static]
Prepare Memory manager for the coming application exit.
Since
3.1

RemoveCollector(MMemoryCollector *)

IMPORT_C void RemoveCollector ( MMemoryCollector * aCollector ) [static]
unregister a memory collector
Since
3.1

Parameters

MMemoryCollector * aCollector the collector to be unregistered

RemoveStopper(MOOMStopper *)

IMPORT_C void RemoveStopper ( MOOMStopper * aStopper ) [static]
unregister a stopper
Since
3.1

Parameters

MOOMStopper * aStopper the stopper to be unregistered

ResetOOMDialogDisplayed()

IMPORT_C void ResetOOMDialogDisplayed ( ) [static]
Reset the OOM dialog display flag in the memorypool; we want to pop the OOM dialog once per page, so we need to clear this when we are either done with the page (it unloads) or when we load a new one, so that it will display again when we run out of memory
Since
9.2

RestoreCollectors()

IMPORT_C void RestoreCollectors ( ) [static]
Called when application is no longer in OOM situation.
Since
3.1

SetNotifier(MOOMNotifier *)

IMPORT_C void SetNotifier ( MOOMNotifier * aNotifier ) [static]
set the OOM notifier, memory manager doesn't own this notifier
Since
3.1

Parameters

MOOMNotifier * aNotifier the notifier

SetRescueBufferSize(TInt)

IMPORT_C void SetRescueBufferSize ( TInt aSize ) [static]
Called when application wants to change the rescue buffer size
Since
3.1

Parameters

TInt aSize

SetStatus(TOOMCheckResult)

IMPORT_C void SetStatus ( TOOMCheckResult aType = ENoOOM ) [static]
Trigger an OOM event, this function is only for debugging purpose
Since
3.1

Parameters

TOOMCheckResult aType = ENoOOM defines where memory allocation fails

Status()

IMPORT_C TUint Status ( ) [static]
Get the status of memory manager, specific state could be retrieve by AND (&) operator with TOOMCheckResult enum
Since
3.1

SwitchToFastAllocator()

IMPORT_C RAllocator * SwitchToFastAllocator ( ) [static]
switch to the allocator using fast dlmalloc
Since
3.1