Skip to content

Commit

Permalink
Free memory allocated for typed arrays
Browse files Browse the repository at this point in the history
This patch fixed the memory leak when using typed arrays on nodejs > 10

Fix: #842
  • Loading branch information
minggangw committed Jun 16, 2022
1 parent e5ddff0 commit 96ed216
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/rcl_bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,7 @@ NAN_METHOD(CreateArrayBufferFromAddress) {
memcpy(backing->Data(), addr, length);
auto array_buffer =
v8::ArrayBuffer::New(v8::Isolate::GetCurrent(), std::move(backing));
free(addr);
#endif

info.GetReturnValue().Set(array_buffer);
Expand Down

0 comments on commit 96ed216

Please sign in to comment.