I found 7650's JVM had a serious bug.When I read a big block
of data from RMS, using RecordStore's method getRecord,
JVM alloc new memory from system, but not from the free memory JVM had managed. So if I do the RMS operation for many times, the memory used by JVM increased fast, although the memory actually used by program didn't change. And at last it lead to "memory full" error.
The bug exists in both emulator and real 7650.
I guess the bug of Image and Resource also come from it...
I have concerns about bugs too... but have found no way to get a response from Nokia about them. I tried emailing the forum helpdesk to ask how I report a bug, but have had no reply. (My problem is with RMS on Series 40, but I mentioned 7650 memory leaks also).
If you find a way to get a response, I'd be glad to know how!!!
I did some tests on emulator and real 7650. I read various blocks of data from RMS, and watched the Total Memory(memory JVM used) and Free Memory changing by using Runtime.getRuntime.totalMemory() and Runtime.getRuntime.freeMemory().
I found that the totalMemory continuously increased, so did freeMemory. In other words, although my program didn't use more memory, JVM ate system's memory fastly.
I thought the reason may be the JVM's memory collection algorithm's bug. The algorithm cannot collect two joint small pieces of free memory into one big piece of memory. When MIDlet request a different size of memory, JVM cannot alloc the free memory it managed, but request new memory from system.
So I thought a way to try to solve it.
At the begging of program, I alloc a big piece of memory (800KB, for example), and release it, then do subsequent RMS operations. The result shown on screen was very good, that totalMemory didn't change. But when I moved the program to real 7650 machine, I found that although the totalMemory result on screen was the same as emulator(no change), when I watched system memory by a memory monitor, JVM ate more and more memory as of old!
I cannot think any more way to handle the problem.