-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Look for zero-copy optimizations using Nan::NewBuffer
#531
Comments
A problem in many cases is that |
@talaj - one way I've found to handle this situation is to use
What do you think? Is that viable for node-mapnik / usecases you have in mind? One downside of this approach is that it looks like the memory is leaked to leak checkers like https://clang.llvm.org/docs/LeakSanitizer.html |
I think this is great solution. It can be a simple wrapper function around |
Good idea. |
@talaj if you end of applying this in your work in node-mapnik, we should be fine without LeakSantizer issues since the LeakSantizer is currently disabled (refs #747). But ideally we can enable it in the future. Anyway, wanted to follow through on what I see when applying this approach and testing with LeakSantizer:
I figure LeakSanitizer is correct that the memory is not being cleaned up right away, but that is by design: by transferring ownership of the string to the |
Using
Nan::NewBuffer
allows the existing memory to be referenced rather than copied when creating anode::Buffer
. Currently we are not usingNan::NewBuffer
but there a likely a number of spots where we could safely benefit from this optimization.The text was updated successfully, but these errors were encountered: