Skip to content

Commit

Permalink
Allow specifying max heap size from env
Browse files Browse the repository at this point in the history
  • Loading branch information
twizmwazin committed Dec 20, 2023
1 parent 670fcd1 commit 7a3f621
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pysoot/jython_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def __init__(self, jython_folder, module_name, class_name, java_heap_size=None):
self.module_name = module_name
self.client_stderr = ""
self.client_stdout = ""
if java_heap_size is None:
if java_heap_size is not None:
self.java_heap_size = java_heap_size
elif "JYTHON_HEAP_SIZE" in os.environ:
self.java_heap_size = int(os.environ["JYTHON_HEAP_SIZE"])
else:
# use 75% of total memory for the Java heap
self.java_heap_size = int(psutil.virtual_memory().total*0.75)
else:
self.java_heap_size = java_heap_size
self._start_jython()

def _start_jython(self):
Expand Down

0 comments on commit 7a3f621

Please sign in to comment.