I guess this is a trivial question and should be answered a hundred times before but probably I'm not on using right keywords.
How do you know how much memory you are allowed to use?
You may say it depends on ram size of your phone model, but users may have a variety of models. Suppose I can limit used models, but how can I find ram size of a specific phone model (which I don't have in my hand)?
I really hope some one can help me.
Any thing and any clues are appreciated.
Thank you in advance
Originally, Java ME was targeted for devices with: "At least 192 KB of total memory available for the Java platform" --Java ME Platfor SDK 3.0 - Help > CLDC and MIDP Stack.
These days Java ME uses the Mobile Service Architecture (MSA) stack with extensions (JSR 248). From JSR 248 Specifications, 7.2 Hardware Requirements:
7.2.3 Java Heap Size Available to MIDlet
Clarification ID: CID.248.3
Under normal conditions (see the definition below), a compliant implementation MUST ensure that Java heap size available to a MIDlet is at least 1024 kB. Further, under normal conditions, a compliant implementation SHOULD ensure that Java heap size available to a MIDlet is at least 2048 kB.
Normal conditions are defined as follows:
.) A new, "out of the box" device is switched on, and a MIDlet suite is installed. There is only one MIDlet in a MIDlet suite.
.) The device is switched off and then switched back on. The MIDlet is started.
One reference method to test the Java heap size requirement is defined as follows:
.) A MIDlet started under normal conditions is able to successfully allocate fifteen (15) byte arrays, of size 64 kB each. (Note: The number of byte arrays is intentionally 15 rather than 16, because it is assumed that the remaining 64 kB are used to store the MIDlet's class files in their runtime form, and to store the MIDlet’s internal runtime data structures.)
Here is sample code that illustrates this test method: