After 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.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.