Skip to content

State load/save memory leak #78

Description

@swigof

In the web emulator, loading and saving state repeatedly will eventually cause out of memory errors.

When saving and loading state, a withNewFileData function calls _file_data_delete to free the state data, but doesn't fully free it or isn't working.

binjgb/docs/simple.js

Lines 202 to 209 in 4fd2ad0

withNewFileData(fileDataPtr, cb) {
const buffer = makeWasmBuffer(
this.module, this.module._get_file_data_ptr(fileDataPtr),
this.module._get_file_data_size(fileDataPtr));
const result = cb(fileDataPtr, buffer);
this.module._file_data_delete(fileDataPtr);
return result;
}

If I add a _free call against the fileDataPtr there, that seems to work fine.

This is may also be a problem in the native build, but I haven't tested that.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions