Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow specifying max heap size from env #18

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 "PYSOOT_HEAP_SIZE" in os.environ:
self.java_heap_size = int(os.environ["PYSOOT_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