Symbian
Symbian OS Library

FAQ-0911 How do I free up system memory for my application?

[Index][spacer] [Previous] [Next]



 

Classification: C++ Category: Memory Management & Cleanup
Created: 07/30/2003 Modified: 08/01/2003
Number: FAQ-0911
Platform: Not Applicable

Question:
My application uses a lot of RAM. What is the most user-friendly way to secure the resources I need to get the app running?

Answer:
Since Symbian OS v6.1, it has been unnecessary for developers to worry about managing system memory to allow their own app to start up. (See FAQ-0790 for more details.) Under both Series 60 and UIQ, if not enough system memory is available, running apps are closed down by the system (if possible) to free up RAM for the newly launched application. However there is a way to free up system memory without the (usually lengthy) process of shutting down other apps. That is to use the User::CompressAllHeaps() method.

This method has the effect of reclaiming any available pages at the top of each user heap. It does not attempt any heap defragmentation (which is not anyway supported on Symbian OS) and ignores any heaps which are locked, so is very quick.