Coder Social home page Coder Social logo

memory access out of bounds about vmsg HOT 6 OPEN

kagami avatar kagami commented on September 28, 2024 4
memory access out of bounds

from vmsg.

Comments (6)

Kagami avatar Kagami commented on September 28, 2024 1

Thanks for report, David. I will check it.

from vmsg.

Kagami avatar Kagami commented on September 28, 2024 1

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.)

from vmsg.

RamboWasReal avatar RamboWasReal commented on September 28, 2024

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.

from vmsg.

0xAlwaysDumpling avatar 0xAlwaysDumpling commented on September 28, 2024

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

from vmsg.

a-h-abid avatar a-h-abid commented on September 28, 2024

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

from vmsg.

oleg-preply avatar oleg-preply commented on September 28, 2024

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!

from vmsg.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.