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

Python: Reduce memory usage when restoring snapshot #1875

Merged
merged 2 commits into from
Mar 27, 2024

Conversation

hoodmane
Copy link
Contributor

Previously we paid for two copies of the snapshot memory: one copy in the wasm linear memory itself and a second copy in BUNDLE_MEMORY_SNAPSHOT. This ensures that we never have more memory than one copy of the linear memory heap by copying the memory directly from the snapshot to the linear memory. We also release the C++ memory when we are done with it.

@hoodmane hoodmane marked this pull request as ready for review March 21, 2024 18:57
@hoodmane hoodmane requested review from a team as code owners March 21, 2024 18:57
@hoodmane hoodmane force-pushed the hoodmane/reduce-snapshot-memory-usage branch from 7c6c2ca to 35d5ea1 Compare March 21, 2024 18:57
src/workerd/api/pyodide/pyodide.h Outdated Show resolved Hide resolved
src/workerd/api/pyodide/pyodide.c++ Outdated Show resolved Hide resolved
src/workerd/api/pyodide/pyodide.c++ Outdated Show resolved Hide resolved
src/pyodide/internal/python.js Outdated Show resolved Hide resolved
src/workerd/api/pyodide/pyodide.h Outdated Show resolved Hide resolved
@hoodmane hoodmane force-pushed the hoodmane/reduce-snapshot-memory-usage branch from 35d5ea1 to 6787e25 Compare March 22, 2024 12:11
src/workerd/api/pyodide/pyodide.h Outdated Show resolved Hide resolved
@hoodmane hoodmane force-pushed the hoodmane/reduce-snapshot-memory-usage branch 3 times, most recently from 8d2fe64 to 84687f2 Compare March 22, 2024 16:35
Previously we paid for two copies of the snapshot memory: one copy in the wasm
linear memory itself and a second copy in `BUNDLE_MEMORY_SNAPSHOT`. This ensures
that we never have more memory than one copy of the linear memory heap by
copying the memory directly from the snapshot to the linear memory. We also
release the C++ memory when we are done with it.
@hoodmane hoodmane force-pushed the hoodmane/reduce-snapshot-memory-usage branch from 84687f2 to 34da5ba Compare March 26, 2024 14:24
@hoodmane hoodmane merged commit 4b786cf into main Mar 27, 2024
10 checks passed
@hoodmane hoodmane deleted the hoodmane/reduce-snapshot-memory-usage branch March 27, 2024 11:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants