06-15-2012 02:04 AM
For a Project we need to interface Labwindows-CVI/ Teststand with an application written in Java. we are using JNI. The code uses JNI_CreateJavaVM to start a JVM to run the Java interface code. The code did run for some time , but now ( without any obvious change nor on the CVI side neither on the Java side) JNI_CreateJavaVM fails with -4 error code, that means that the start of the JVM failed due to memory allocation failure. First investigation showed, that even if Windows Task Manager shows about 600M free physical memory, you can allocate in CVI only about 250M as a single block at the time we are calling JNI_CreateJavaVM. That might be a little bit to less as we need to pass -Xmx192m to the JVM to run our code. Unfortunately just increasing the physical memory of that machine from 1.5G to 2G doesn't change anything. The free memory showed by Task Manager increases, but the allocatable memory block size does not. Are the any trick to optimize CVI/Teststand for that use case ? Or maybe known problems with JNI ?
Solved! Go to Solution.
06-26-2012 02:54 AM
hi,
have you tried other functions to allocate memory?
the -Xmx command only sets the maximum heap size. You can try to use -Xms. This command sets the initial Java heap size.
06-27-2012 03:51 AM
Finally it was a memory fragmentation issue caused by TestStand. Details/workaround see here