Skip to content

[JAVA] Leak in JdbcToArrowUtils #408

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

Open
asfimport opened this issue Jun 9, 2019 · 1 comment
Open

[JAVA] Leak in JdbcToArrowUtils #408

asfimport opened this issue Jun 9, 2019 · 1 comment
Labels
Type: bug Something isn't working

Comments

@asfimport
Copy link

JdbcToArrowUtils::updateVector(VarCharVector, String, boolean, int) does not release the memory that it allocates for the NullableVarCharHolder. This can be verified by changing the first lines of JdbcToArrowTest::testJdbcToArrowValues() to the following:

RootAllocator allocator = new RootAllocator(Integer.MAX_VALUE);
VectorSchemaRoot root = JdbcToArrow.sqlToArrow(conn, table.getQuery(), allocator, Calendar.getInstance());
testDataSets(root);
root.close();
assertEquals(allocator.getAllocatedMemory(), 0);

 

The leak can be fixed by closing the buffer in updateVector. However, I would propose to not use the NullableVarCharHolder in the first place because it creates an unnecessary copy of the string. Instead, I would use BaseVariableWidthVector::setSafe(int index, byte[] value) and BaseVariableWidthVector::setNull(int index) directly.

In addition, I would propose to check for leaks in JdbcToArrowTest.

I am willing to create a patch, so please let me know what approach is preferred.

Reporter: Johannes Luong / @jmaschad

Note: This issue was originally created as ARROW-5536. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Todd Farmer / @toddfarmer:
This issue was last updated over 90 days ago, which may be an indication it is no longer being actively worked. To better reflect the current state, the issue is being unassigned. Please feel free to re-take assignment of the issue if it is being actively worked, or if you plan to start that work soon.

@assignUser assignUser transferred this issue from apache/arrow Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant