diff -r 43e37759235e -r 51a74ef9ed63 Symbian3/SDK/Source/GUID-239AA6F5-30CE-5FF0-9C36-93D39FECE1DD.dita --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/SDK/Source/GUID-239AA6F5-30CE-5FF0-9C36-93D39FECE1DD.dita Wed Mar 31 11:11:55 2010 +0100 @@ -0,0 +1,26 @@ + + + + + +How +to switch heapsAfter a call to User::SwitchHeap(), any new request +for memory is satisfied from the new heap. +

A thread can switch between heaps using User::SwitchHeap().

+

After a call to this function, any new request for memory is satisfied +from the new heap.

+

When freeing memory, it is extremely important that the current +heap is the heap from which it was allocated. Trying to free a memory cell +from a heap when it was allocated from a different heap has undefined consequences.

+Thing* mything = new Thing; // Allocate on current heap +RHeap* oldHeap = User::SwitchHeap(newHeap);// Change heaps +... // Use new heap +User::SwitchHeap(oldHeap); // Change to old heap +delete mything; // before deleting. +
\ No newline at end of file