Constant pool is known to occupy the biggest part in size in a typical Java class file. It is very important for any embedded system to restrict the usage of memory since memory is one of the most vital resource of the system. Because constant pool ho...
Constant pool is known to occupy the biggest part in size in a typical Java class file. It is very important for any embedded system to restrict the usage of memory since memory is one of the most vital resource of the system. Because constant pool holds the majority of Java class file in size, we are interested in knowing how to reduce its effect.
In this paper we have analyzed all entries in constant pool and gathered the statistics in detail. Specifically, we have investigated a hundred of Java class files for embedded system, one from the J2ME/CLDC classes of Sun Microsystems, and others from the simpleRTJ classes of RTJ Computing. The statistics said that there are forty four constants on the average in the pool and only six percents of them are actually used to execute the bytecode instructions. Another seventy eight percents of the constant are used merely for type-checking and linking classes. It suggests the possibility of reducing memory usage by restricting runtime type-checking and dynamic class loading, which is not an extraordinary condition for embedded system. The result would be applied to build a more memory-efficient embedded Java system.