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 issue after changing tracks enough times #5

Open
Yum0987654321 opened this issue Oct 24, 2021 · 2 comments
Open

Memory issue after changing tracks enough times #5

Yum0987654321 opened this issue Oct 24, 2021 · 2 comments

Comments

@Yum0987654321
Copy link

After changing tracks ~75 times, an abort is thrown regarding enlargeMemory()

Uncaught abort() at abort@(...)/libgme.js:5887:26
enlargeMemory@(...)/libgme.js:692:8
dynamicAlloc@(...)/libgme.js:422:164
_sbrk@(...)/libgme.js:3511:28
vi@(...)/libgme.js:4479:66657
vl@(...)/libgme.js:4479:79710
ek@(...)/libgme.js:4477:20573
eR@(...)/libgme.js:4477:25824
de@(...)/libgme.js:4477:12935
hR@(...)/libgme.js:4477:62301
fr@(...)/libgme.js:4477:40306
fq@(...)/libgme.js:4477:39649
ccallFunc@(...)/libgme.js:507:24
ccall@(...)/libgme.js:465:10
(app code)
@Yum0987654321
Copy link
Author

This can be resolved by moving the allocation of the buffer outside of the playMusicData function.

const buffer = Module.allocate(bufferSize * 2, 'i32', Module.ALLOC_STATIC);

@Yum0987654321
Copy link
Author

It may also be worth moving the other allocate outside of a function as well.

ref = Module.allocate(1, 'i32', Module.ALLOC_STATIC);

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