Skip to content

hardfist/emnapi-shared-memory-grow-repro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

emnapi shared memory grow repro

This reproduces a bug where a DataView created from the current wasm shared memory is passed back into N-API after memory.grow(), and napi_get_dataview_info(..., &arraybuffer, ...) returns the old SharedArrayBuffer instead of the current memory.buffer.

Run

npm install
npm start

Expected

After memory.grow(), CreateDataViewFromJSDataView(view) should rebuild the returned view against the new memory.buffer.

The last two fields should be:

{
  "returnedViewUsesOldBuffer": false,
  "returnedViewUsesNewBuffer": true
}

Actual

With the buggy behavior, the script prints:

{
  "returnedViewUsesOldBuffer": true,
  "returnedViewUsesNewBuffer": false
}

and exits with code 1.

Notes

  • dataview.wasm is a prebuilt minimal test module compiled from emnapi's existing packages/test/dataview/binding.c.
  • The repro depends on the latest published @emnapi/core and @emnapi/runtime versions pinned in package.json.
  • The script uses process.reallyExit() when available to avoid unrelated wasm32 env teardown noise when finishing the repro process.

About

.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors