mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
worker: keep allocators for transferred SAB instances alive longer
Keep the `ArrayBuffer::Allocator` behind a `SharedArrayBuffer` instance alive for at least as long as the receiving Isolate lives, if the `SharedArrayBuffer` instance isn’t already destroyed through GC. This is to work around the fact that V8 7.9 started refactoring how backing stores for `SharedArrayBuffer` instances work, changing the timing of the call that releases the backing store to be during Isolate disposal. The flag added to the test is optional but helps verify that the backing store is actually free’d at the end of the test and does not leak memory. Fixes: https://github.com/nodejs/node-v8/issues/115 PR-URL: https://github.com/nodejs/node/pull/29637 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
This commit is contained in:
1 parent
91e4cc7500
commit
04df7dbadb
5 files changed
+51
No files matched your search
@@ -37,6 +37,9 @@ class SharedArrayBufferMetadata
|
||||
// count is increased by 1.
|
||||
v8::MaybeLocal<v8::SharedArrayBuffer> GetSharedArrayBuffer(
|
||||
Environment* env, v8::Local<v8::Context> context);
|
||||
std::shared_ptr<v8::ArrayBuffer::Allocator> allocator() const {
|
||||
return allocator_;
|
||||
}
|
||||
|
||||
SharedArrayBufferMetadata(SharedArrayBufferMetadata&& other) = delete;
|
||||
SharedArrayBufferMetadata& operator=(
|
||||
|
||||
Reference in new issue
Block a user