File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ The `Napi::ArrayBuffer` instance does not assume ownership for the data and
2929expects it to be valid for the lifetime of the instance. Since the
3030`Napi::ArrayBuffer` is subject to garbage collection this overload is only
3131suitable for data which is static and never needs to be freed.
32+ This factory method will not provide the caller with an opportunity to free the
33+ data when the `Napi::ArrayBuffer` gets garbage-collected. If you need to free
34+ the data retained by the `Napi::ArrayBuffer` object please use other
35+ variants of the `Napi::ArrayBuffer::New` factory method that accept
36+ `Napi::Finalizer`, which is a function that will be invoked when the
37+ `Napi::ArrayBuffer` object has been destroyed.
3238
3339```cpp
3440static Napi::ArrayBuffer Napi::ArrayBuffer::New(napi_env env, void* externalData, size_t byteLength);
Original file line number Diff line number Diff line change @@ -28,6 +28,12 @@ The `Napi::Buffer` object does not assume ownership for the data and expects it
2828valid for the lifetime of the object. Since the `Napi::Buffer` is subject to garbage
2929collection this overload is only suitable for data which is static and never
3030needs to be freed.
31+ This factory method will not provide the caller with an opportunity to free the
32+ data when the `Napi::Buffer` gets garbage-collected. If you need to free the
33+ data retained by the `Napi::Buffer` object please use other variants of the
34+ `Napi::Buffer::New` factory method that accept `Napi::Finalizer`, which is a
35+ function that will be invoked when the `Napi::Buffer` object has been
36+ destroyed.
3137
3238```cpp
3339static Napi::Buffer<T> Napi::Buffer::New(napi_env env, T* data, size_t length);
You can’t perform that action at this time.
0 commit comments