When running Apache Derby unit tests on phoneME, we frequently see
OutOfMemoryErrors (or sometimes java.lang.InternalError: Number of
class names exceeds vm limit). These errors appear to happen because
phoneME runs out of space for classes. However, if we add explicit
calls to System.gc(), the problems go away. So the problem seems to be
that phoneME doesn't automatically run garbage collection when it's
about to run out of space for classes.
phoneME should be able to detect that it's about to run out of class
space and invoke garbage collection, so that the applications don't
need to run garbage collection manually.
(This seems to be more of a problem when running with heap settings
higher than the default, as that would reduce the chance of the heap
getting full and implicitly triggering timely garbage collection.)