Prev: Native Icons
Memory Allocation
All memory allocated via
runtime->New...L() calls is subject to garbage collection: if it is not referenced by an
m variable (or array), it will be collected and freed. The
m runtime system maintains references to all memory chunks it has allocated.
m objects must therefore never be pushed on the Symbian cleanup stack.
No garbage collection takes place during native function calls, or between calls to ExecuteL() when waiting for asynchronous events.
As a side effect of memory allocation and garbage collection, the location of variables in memory may change between calls to native functions. C++ pointers and references to m values are therefore only valid during a call to ExecuteL().
If your module creates Symbian objects or allocates raw memory outside the m universe and does not tie the object or memory to an m native object value, you must ensure yourself it is properly freed when the module is destroyed (i.e. in its destructor). Closing an m process will destroy all its module instances.
Next: Module Loading and Initialization© 2004-2011 airbit AG, CH-8008 Zürich
Document AB-M-NMI-887