Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-5536

[JAVA] Leak in JdbcToArrowUtils

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • Java
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            jmal86 Johannes Luong
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated: