Heap memory available for an app using Symbian C++
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:
UID 0x00000000 KMemoryTestUID3
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.