I particularly like the way that the
Pre-verifier adds (at least for me) 15%-22% size increase to the class files!!
Have a go at compiling your classes manually then look at the class file size before and after Preverify and note how much bigger they get...
Does anybody actually know what the Preverifier actually does? Its only supposed to add a stack map attribute to
each method but I've come across classes it does not seem to touch.
Thats another way to squeeze those class files, use as few methods as possible!
The MIDP V1.0 spec states that for memory consumption the
minimum should be:
128K of non-volatile memory for the MIDP components.
8K of non-volatile memory for application-created persistence data
32K of volatile memory for java runtime (heap etc).
All these other limitations (such as max class file size, or jar file size) are just imposed by the manufacturer.
For example almost all (if not all) current (2003) Siemens phones have a wonderful size constraints of 16K on
everything:
quote taken from page 96 of the Siemens Mobility Toolkit
(SMTK)for Java (tm) Development Programmer's Reference Version 3.1,0 6 /2003.
NOTE: Siemens Java (tm)-enabled mobile phones have a memory limitation that
only allows to be created instance of classes and variables with size fewer than
16.384 bytes (16Kb). So, be sure if your image file has a size smaller that the
maximum size.
MIDP V1.0 spec (thats JSR-37) can be found here:
http://jcp.org/aboutJava/communityprocess/final/jsr037/index.htmlMIDP V2.0 spec (JSR-118 ) :
http://jcp.org/aboutJava/communityprocess/final/jsr118/index.htmlAnd a list of
all the JSR extensions for J2ME can be found here (all 55 of them!):
http://jcp.org/en/jsr/tech?listBy=1&listByType=platformWhats needed is a list of phones (or KVM's) and their limitations. Because manufacturer are quite happy to leave out this information from specs.
I had hoped
http://www.jbenchmark.com would, but they don't even seem to bother filtering out bogus scores.
------
Woz.