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

memory access out of bounds #25

Open
RamboWasReal opened this issue Jan 14, 2019 · 6 comments
Open

memory access out of bounds #25

RamboWasReal opened this issue Jan 14, 2019 · 6 comments

Comments

@RamboWasReal
Copy link

When i try to record more than 8min i receive this error. (in google chrome)
anybody know's how to remedy ?

Uncaught RuntimeError: memory access out of bounds
at wasm-function[11]:24
at wasm-function[254]:86
at wasm-function[241]:34
at vmsg_flush (blob:)
at onmessage (blob:)

thank you

@Kagami
Copy link
Owner

Kagami commented Jan 14, 2019

Thanks for report, David. I will check it.

@RamboWasReal
Copy link
Author

I searched online and I did not foud anything to help me. I'm not a profesionnal, so if you know where to look in the code to correct the situation please tell me and I will try to solve it on my own.

Thanks.

@0xAlwaysDumpling
Copy link

Anyone know how to solve this problem? I am trying to record audio up to 30 minutes.

@a-h-abid
Copy link

a-h-abid commented Apr 2, 2019

Hi @Kagami, have you managed to solve this issue? I'm also having trouble when trying to record more than 15mins.

@oleg-preply
Copy link

Hi! I've faced the same on the 8th minute.

The reason might be the memory limit set in the package to 16MB. The obvious way seems to try to increase it, but:

  • changing the value requires also recompiling .wasm with a new value, as commented above the variable via the link ☝️, also like proposed here. So there is no way dynamically adjust that option since it requires compiling/downloading another .wasm module
  • I'm not sure what are downsides of increasing size. Like in the solution above folks noticed worse performance.

In the same time, I've tried to increase only TOTAL_MEMORY to 50MB (but didn't recompile .wasm) and succeeded in the recording of 15minutes 🎉 So maybe .wasm module is already compiled with a bigger value?
Also, I'm wondering how it can affect mobile devices, where OS memory limits might be lower 🤔

@Kagami do you think the increase of TOTAL_MEMORY is a legit solution?

Thanks in advance!

@Kagami
Copy link
Owner

Kagami commented Jun 30, 2019

Hi, @oleg-preply. It's ok to bump TOTAL_MEMORY, you don't need to recompile wasm module for that. Basically WebAssembly.Memory is an array of bytes you create for your wasm module, so you can use any size it would need. Browsers might not allow to allocate really big e.g. 1GB memory arrays but 100-200MB should be fine even on mobile.

When I was creating this library I thought 16MB is enough for most MP3 records, but seems like it's not. We should either allow to setup TOTAL_MEMORY value via option passed to record/Recorder. Or send compressed MP3 samples from worker to main thread right away, as described in #23.

Second option is better because memory would be consumed in a more optimal way, without allocating MP3 twice, first at worker and then at main thread and spawning wasm module with a lot of memory. But first option is easier to implement and should be ok as short-term solution.

(Btw, it's also possible to grow memory on demand, but I haven't implemented it either.)

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

5 participants