Issue Details (XML | Word | Printable)

Key: JDBC-378
Type: Task Task
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Mark Rotteveel
Reporter: Mark Rotteveel
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Jaybird JCA/JDBC Driver

Check if bytebuffers in JNA need to be pooled

Created: 16/Dec/14 09:06 PM   Updated: 07/May/17 12:32 PM
Component/s: JNI/JNA layer
Affects Version/s: Jaybird 3.0.0
Fix Version/s: Jaybird 3.0.0


 Description  « Hide
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).

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Mark Rotteveel added a comment - 06/Jul/16 10:14 AM
Pooling is too much work/error prone, however in JnaBlob I now cache the ByteBuffer, and only reallocate if a larger one is needed.