1

I'm currently working on a project where I need to call a rather large jar file from Python code. For this I'm using jpype and with a smaller stub jar the code worked perfectly. However, the larger jar requires a lot of memory, so I set -Xmx in the arguments that are passed to the startJVM call. However, this crashes with a could not reserve enough space for object heap error in Python.

The value I'm using for -Xmx is 1099m, if I decrement this value by one and use 1098m then enough memory can be reserved and the JVM starts. However, to successfully use the Jar I need more than 1098.

When calling startJVM enough memory is available on my machine, usually at least 3GB. Furthermore, if I run the jar directly from the command line using java -Xmx2000m -jar then it starts without any problems. Which leads me to believe that I might be doing something wrong.

I'm running the code on a 64 bit Windows installation with Python 2.7 32 bit and a 32 bit Java 8 JDK. The following line is the line I use to start the JVM from Python:

startJVM("PATH", "-Xmx1099m", "-Djava.class.path=PATH_TO_JAR")

Does anyone know a possible solution to start the JVM with jpype with more than 1089 MB of heap space?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.