-
Notifications
You must be signed in to change notification settings - Fork 40
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
Out of Memory Errors #420
Comments
It is 10000% possible I made mistakes in my measurements etc, please check all of my work and ensure it is valid |
NOTE ---- Side note: I was experimenting to see how much makes PM OOM by running this: import pythonmonkey as pm
pm.eval("""
try {
const chunks = [];
let size = 1e6; // Start with 1MB chunks
while (true) {
chunks.push(new Array(size).fill(0)); // Allocate memory
console.log(`Allocated ${chunks.length * size} bytes`);
}
} catch (e) {
console.error('Out of memory:', e.message);
}
""") But it seemed to freeze at around 2GB of allocated memory, despite this, my system was using about 20gb of memory across my RAM and swap...BUT I never actually got an OOM error running this code, unlike the example in the above ticket description |
one more example we are looking at: #!/usr/bin/env python3 lst1 = [] #arr_size = 2500 for i in range(arr_size): args2 = [lst1, lst2] data = [1, 2, 3, 4, 5] work_function = """ async def pringle():
dcp_client'init' Latest error output: exec Unhandled error in exception handler Unhandled error in exception handler During handling of the above exception, another exception occurred: Traceback (most recent call last): makes it look like something |
for the main code sample, in pm, there is no stack associated with the JS exception, only the message |
Looking at https://discourse.mozilla.org/t/how-does-spidermonkey-deal-with-memory-limitations/123670/2 we need to call with this the main example is fixed |
alternate example now getting different result -> onto its own ticket: #423 |
The main example with arr_size = 1030000 now works with |
we can achieve the same max heap increase by calling |
Issue type
Bug
How did you install PythonMonkey?
Installed from pip
OS platform and distribution
Ubuntu 22.04.4 LTS x86_64
Python version (
python --version
)3.10.12
PythonMonkey version (
pip show pythonmonkey
)0.8.0
Bug Description
I notice PythonMonkey will OOM in weird circumstances, and looking at
ps -p $pid -o rss=
, the rss memory usage (measured in kb) only hangs around the 200mb range (would be hilarious if I was off by a factor of 10 --- double check my work)One thing to note, maybe this is expected? If it is, it would be sad - so hoping it's a bug!
Standalone code to reproduce the issue
Relevant log output or backtrace
Additional info if applicable
What branch of PythonMonkey were you developing on? (If applicable)
No response
The text was updated successfully, but these errors were encountered: