Differences in JVM memory management in 1.4.2 and 1.5?
Hi all,
We have developed some code calling a third party dll through JNI. The code runs fine on jre 1.4.2. When we test in on jre 1.5, the dll is giving us a heap memory exhausted message. We have set -Xmx to 1024m due to performance issue. If we lower -Xmx from 1024m to 912m, then the program runs fine. So I have question if memory is being handled differently in 1.4.2 and 1.5?
Envirnoment: Windows XP, JRE 1.4.2 and 1.5, 1GB memory
Thanks all!
[474 byte] By [
m9wonga] at [2007-10-2 17:50:07]

Hi,
I keep some rules while developing JNI code:
- reduce to minimum use of Local Heap, try to use Global or Virtual memory,
- reduce to minimum a number of local/gobal references used, make shallow copy of the same reference like it is done in Windows COM,
- reduce to minimum a number of stack variables,
- be sure that JNI code has no memory leaks.
To solve these problems I have developed for MS Visual Studio tools
http://www.simtel.net//product.php%5bid%5d93174%5bSiteID%5dsimtel.net
http://www.simtel.net/product.php[id]94368[sekid]0[SiteID]simtel.net
The tools solve these problems and are used by other people in my company (for developing JNI code). They do not know anything about these issues.