MemoryManager Class Reference

class MemoryManager
A class handles all memory operations and OOM issues memman.lib
Since
3.1
Public Member Functions
IMPORT_C voidAddCollector(MMemoryCollector *)
IMPORT_C voidAddStopper(MOOMStopper *)
IMPORT_C voidCloseFastAllocator(RAllocator *)
IMPORT_C voidCreateFastAllocator()
IMPORT_C voidFreeRam()
IMPORT_C voidInitFastAllocator()
IMPORT_C voidInitOOMDialog()
IMPORT_C TUintMemorySize(TAny *)
IMPORT_C TUintPostCheck()
IMPORT_C TBoolPreCheck(TUint, TUint, const TDesC8 &)
IMPORT_C voidPrepareForExit()
IMPORT_C voidRemoveCollector(MMemoryCollector *)
IMPORT_C voidRemoveStopper(MOOMStopper *)
IMPORT_C voidResetOOMDialogDisplayed()
IMPORT_C voidRestoreCollectors()
IMPORT_C voidSetNotifier(MOOMNotifier *)
IMPORT_C voidSetRescueBufferSize(TInt)
IMPORT_C voidSetStatus(TOOMCheckResult)
IMPORT_C TUintStatus()
IMPORT_C RAllocator *SwitchToFastAllocator()

Member Functions Documentation

AddCollector(MMemoryCollector *)

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

Parameters

MMemoryCollector * aCollectorthe collector to be registered

AddStopper(MOOMStopper *)

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

Parameters

MOOMStopper * aStopperthe stopper to be registered

CloseFastAllocator(RAllocator *)

IMPORT_C voidCloseFastAllocator(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 voidCreateFastAllocator()[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 voidFreeRam()[static]
Free some RAM. Calls collect on registered collectors
Since
3.1

InitFastAllocator()

IMPORT_C voidInitFastAllocator()[static]

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

Since
9.2

InitOOMDialog()

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

MemorySize(TAny *)

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

Parameters

TAny * aPtr

PostCheck()

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

PreCheck(TUint, TUint, const TDesC8 &)

IMPORT_C TBoolPreCheck(TUintaTotalSize,
TUintaMaxBufSize,
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 aTotalSizetotal amount of memory
TUint aMaxBufSize
const TDesC8 & aChecker =  KNullDesC8 the name of operation

PrepareForExit()

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

RemoveCollector(MMemoryCollector *)

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

Parameters

MMemoryCollector * aCollectorthe collector to be unregistered

RemoveStopper(MOOMStopper *)

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

Parameters

MOOMStopper * aStopperthe stopper to be unregistered

ResetOOMDialogDisplayed()

IMPORT_C voidResetOOMDialogDisplayed()[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 voidRestoreCollectors()[static]
Called when application is no longer in OOM situation.
Since
3.1

SetNotifier(MOOMNotifier *)

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

Parameters

MOOMNotifier * aNotifierthe notifier

SetRescueBufferSize(TInt)

IMPORT_C voidSetRescueBufferSize(TIntaSize)[static]
Called when application wants to change the rescue buffer size
Since
3.1

Parameters

TInt aSize

SetStatus(TOOMCheckResult)

IMPORT_C voidSetStatus(TOOMCheckResultaType = ENoOOM)[static]
Trigger an OOM event, this function is only for debugging purpose
Since
3.1

Parameters

TOOMCheckResult aType = ENoOOMdefines where memory allocation fails

Status()

IMPORT_C TUintStatus()[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