In my situation I need to use a framework written in Java
, but all the logic is in Python
. I'm calling python script from java. I'm using Ubuntu 12.04
.
The question is if I specify Max Heap
size for Java, will it somehow force or limit python process that will need more memory then specified for JVM, since Java is a parent process for python script?
Asked
Active
Viewed 689 times
0

Vor
- 33,215
- 43
- 135
- 193
-
1Short answer...no. The heap is used internally in Java for objects the JVM instantiates. However, you will run into problems if you create lots and lots of processes, which are represented as an object and would take up JVM memory. I believe Ubuntu uses ulimits, so your shelled processes would be limited to the ulimits set for that user. – CodeChimp Nov 14 '13 at 20:31
1 Answers
2
No, it will not. The JVM does not account for any external memory allocated. I had this exact same question when I was trying to limit the amount of memory that a jni library was using. In my case as will be yours the memory allocated by a sub process does not count toward the size of the Jvm Heap. I was unable to limit the size of memory that the jni library could consume through any java api.
Here is a good overview.
Java app calls C++ DLL via JNI; how best to allocate memory?

Community
- 1
- 1

Chris Hinshaw
- 6,967
- 2
- 39
- 65