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 compiled functions to share memory #125

Merged
merged 2 commits into from
Mar 20, 2024
Merged

Allow compiled functions to share memory #125

merged 2 commits into from
Mar 20, 2024

Conversation

samestep
Copy link
Contributor

@samestep samestep commented Mar 20, 2024

Currently every function created using compile allocates its own memory. This causes problems in applications that call compile many times, because current browsers do not consistently track the amount of allocated Wasm memory with their garbage collectors, and so out-of-memory errors can easily result even if the amount of memory needed at a given time is relatively small.

This PR addresses the issue by allowing the compile function to take in an optional memory parameter, which it will use (and grow if necessary) if provided, instead of always allocating a new memory.

@samestep samestep marked this pull request as ready for review March 20, 2024 14:44
@samestep samestep merged commit 48eb14e into main Mar 20, 2024
2 checks passed
@samestep samestep deleted the shared-memory branch March 20, 2024 14:44
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.

1 participant