Skip to content
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

Check if bytebuffers in JNA need to be pooled [JDBC378] #420

Closed
firebird-automations opened this issue Dec 16, 2014 · 4 comments
Closed

Comments

@firebird-automations
Copy link

Submitted by: @mrotteveel

The JNA driver allocates direct ByteBuffers, however there seems to be some indication (see http://stackoverflow.com/questions/1744533/jna-bytebuffer-not-getting-freed-and-causing-c-heap-to-run-out-of-memory) this might result in Java to run out of direct memory because the garbage collection (which frees the ByteBuffer and therefor the allocated direct memory) might not run in time.

Consider pooling the direct buffers.

Pooling might also have some additional side effect like better performance (less allocation).

Commits: 7791a80

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

Fix Version: Jaybird 3.0 [ 10440 ]

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Pooling is too much work/error prone, however in JnaBlob I now cache the ByteBuffer, and only reallocate if a larger one is needed.

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @mrotteveel

status: Resolved [ 5 ] => Closed [ 6 ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants