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
BytePointer creates leak #380
Comments
Do you have an example of a direct buffer with an array? There can also be non-direct buffers without array, so it's not safe to call |
On my Pixel, the following creates direct buffers with array.
Maybe you could check both conditions?
|
Interesting. Yes, that would be a good idea. Could you send a PR for all
the primitive Pointer classes?
|
I am sorry, I am not sure what you are asking for. |
A pull request to send your patch?
|
Please do send a patch to fix this issue! Thanks a lot |
I've included in JavaCPP 1.3.2 the changes you proposed. Thanks for reporting! |
In BytePointer::BytePointer(ByteBuffer buffer), hasArray() is used to check whether or not buffer is direct. But since it is possible for a direct buffer to return true on that method, this leads to a memory leak.
I would suggest to using instead is isDirect().
The text was updated successfully, but these errors were encountered: