I had developed several PJava games for Nokia 9210 but they have the same problem when executing. Because these are games, I use many image resources in execution and I also try to catch OutofMemory execption. Unfortunely, I didn't catch anything. This problem always happeded after I play these games several times. I am thinking this problem mnaybe occured by the resource released problem. After calling System.exit(0) to quit PJava application, PJava should release all resources related of this application, isn't it? Is there any PJava applicaition developer met this kind of problem? Please help me to fis this bug, thanks a lot.
And I feel this problem happed more often when I turnt on the mobile function. If I remove the battery first then the problem gone for a while. After trying PJava application, it happens again.
Have a nice day
Posted by Wu-Hsiung Li, email@example.com
on May 08, 2002 at 05:35
RE: PJava runtime problem within Nokia 9210, Hrlp~!
System.exit() causes the process to exit - so all resources used by the JVM will be released at that point - unless there is a bug in SymbianOS kernel or one of the servers. I don't think that is the problem.
Images consume alot of memory in AWT. There is usually a block of memory the same size as the image used to decode it - this may or may not be released after the image has been downloaded - depending on the decoder.
You might get some milage from copying images to offscreen images then flushing the original. It is also worth makeing sure that the ImageProducer is sending the correct flags through in imageComplete - you can do this by sticking a filter in between the producer and consumer and watching what goes by. If the producer doesn't indicate that there will be no more frames (something like STATICIMAGEDONE?), the decoding mechanism is likely to be hanging on to a block of memory.
When you say you played the games several times - do you mean that you launched the JVM to run your game - then exited, then launched again, then exited again? Or do you mean launch once and then play several times before exiting?
OutOfMemory exceptions will most likely be thrown on the image fetcher threads - you won't see these - but if you run the redirector it should capture any error message the image fetcher prints out.