Heap memory available for an app using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Platform(s): S60 3rd Edition
S60 3rd Edition (initial release)
Created: User:Technical writer 2 (07 Jul 2006)
Last edited: ashraf fawzy (25 Jul 2012)


Heap memory available for an application


Despite the amount of physical memory available on a given device (or emulated in SDK's emulator), your application will have access to a limited amount of heap memory. When the process in which your application runs is being created, there will be a small heap pre-allocated to this process. The default value is 4 KB on S60 3rd Edition devices and 1 KB on devices based on earlier versions of the S60 platform.
Depending on its needs, the application may freely allocate more heap memory and the amount of heap that the application can use is dynamically increased up to a limit of 1 MB, which is the default upper limit defined by the operating system. An attempt to allocate heap memory that will push the application's allocated heap size beyond this upper limit would fail with a KErrNoMemory leave. Most Symbian C++ applications can work without problems within this heap memory limit but in some cases the high heap size limit needs to be increased.

The lower and upper heap size limits can be specified in the application's MMP file using the EPOCHEAPSIZE statement. Example:

TARGET   MemoryTest.exe
UID 0x00000000 KMemoryTestUID3
VENDORID 0x00000000
EPOCHEAPSIZE 0x5000 0x400000

In the above example the application declares that it needs the lower heaps size limit to be 0x5000 bytes (20 KB) while the upper limit it should be 0x400000 bytes (4 MB). Now this application can safely allocate a block of 3 MB on the heap provided that it has not used already more than 1 MB of heap memory.

Note.pngNote: As documented, prior to S60 3rd Edition the EPOCHEAPSIZE statement has no effect on WINS32 platforms.

This page was last modified on 25 July 2012, at 16:45.
60 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.