Namespaces

Variants
Actions

Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

How to find out the total memory in Java ME

From Wiki
Jump to: navigation, search

Needs-update.pngThis article needs to be updated: If you found this article useful, please fix the problems below then delete the {{ArticleNeedsUpdate}} template from the article to remove this warning.

Reasons: lpvalente (30 Jun 2013)
The article discusses previous Symbian editions, but does not discusses current Asha platforms

This article demonstrates how to find out the total memory available for the device, using Java ME.

See Also

The current total heap memory of VM is retrieved using the following code:

Runtime runt=Runtime.getRuntime();
long totalMemory = runt.totalMemory();

This method however doesn't return all available possible memory in all Java VM implementations like in S60. S60 uses a VM in allocates it's VM heap memory dynamically from operating system. During startup certain amount of heap is reserved but when the memory will be used and the free amount is becoming smaller VM dynamically allocates more heap from OS. The VM also releases unnecessary heap back to operating system. This kind of implementation is important in operating environment with true multitasking capabilities like S60.

In S60 3rd Edition devices there is a system property
com.nokia.memoryramfree

that can be used to query the available RAM available in the operating system. This is much more reliable estimate of available RAM. Although it should be understood that any other application may use this RAM.

Article Metadata
Code ExampleTested with
Devices(s): C3-01, Asha 305, E7-00
CompatibilityArticle
Created: jaakl (15 Sep 2009)
Updated: skalogir (04 Nov 2011)
Reviewed: skalogir (24 Oct 2011)
Last edited: hamishwillee (15 Aug 2013)
This page was last modified on 15 August 2013, at 05:14.
64 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.

×