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

Confirm if there is memory leak #13

Closed
1 task done
mhchia opened this issue Oct 3, 2023 · 2 comments
Closed
1 task done

Confirm if there is memory leak #13

mhchia opened this issue Oct 3, 2023 · 2 comments

Comments

@mhchia
Copy link
Contributor

mhchia commented Oct 3, 2023

What's wrong?

In #6 (comment), we encountered OOM and suspected there was memory leak in the latest multi-threaded prover. It was worked around by increasing wasm memory to 4 GB.

Possible Cause of OOM

The single-threaded prover seems to have a similar memory usage as the multi-threaded prover, but it doesn't encounter an OOM. Thus, I suspect OOM might not result from a memory leak. It happens in multi-threaded prover just because we enable the rustflags atomics (required by wasm-bindgen-rayon) and max-memory is automatically set to 1 GB.

Actions

  • Confirm single-threaded and multi-threaded prover max-memory without setting it explicitly. If they are different, it's possible that OOM is just because multi-thread has a 1 GB max memory while single-threaded doesn't, and thus OOM is possibly not because of the memory leak

Resources

@mhchia
Copy link
Contributor Author

mhchia commented Oct 3, 2023

Using wasm-objdump, we can see there is a max set when using a multi-threaded prover. However, there isn't a maximum memory set when using a single-threaded prover. This could explain why we didn't encounter OOM in a single-threaded prover even if it uses more than 1 GB memory.

Multi-threaded (nightly + rustflags atomics)

max is set to 1 GB (1 GB = 16384 * 64 KB, 16384 pages and 64 KB per page).

$ wasm-objdump --details --section=import target/wasm32-unknown-unknown/release/tlsn_extension_rs.wasm| grep memory
- memory[0] pages: initial=96 max=16384 shared <- env.memory

Single-threaded (stable)

No max is set

$ wasm-objdump --details --section=import target/wasm32-unknown-unknown/release/tlsn_extension_rs.wasm| grep memory
...

@mhchia
Copy link
Contributor Author

mhchia commented Oct 20, 2023

There seems no obvious evidence that a memory leak is occurring now. Close it for now and we can reopen it if it's still relevant

@mhchia mhchia closed this as completed Oct 20, 2023
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

No branches or pull requests

1 participant