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
29
29
expects it to be valid for the lifetime of the instance. Since the
30
30
`Napi::ArrayBuffer` is subject to garbage collection this overload is only
31
31
suitable 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.
32
38
33
39
```cpp
34
40
static 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
28
28
valid for the lifetime of the object. Since the `Napi::Buffer` is subject to garbage
29
29
collection this overload is only suitable for data which is static and never
30
30
needs 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.
31
37
32
38
```cpp
33
39
static 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