duckdb: JDBC Memory leak on CentOS 7.7

What happens?

Memory leak on CentOS 7.7,window is ok. There is a memory leak when executing multiple queries on CentOS 7.7

To Reproduce

We’ve written a minimal reproduction and shared it as a GitHub repository. The reproduction runs for a specified period of time.

Environment (please complete the following information):

  • OS: CentOS 7.7
  • DuckDB Version: 0.3.3
  • DuckDB Client: jdbc
  • ] Have you tried this on the latest master branch?
  • Python: pip install duckdb --upgrade --pre
  • R: install.packages("https://github.com/duckdb/duckdb/releases/download/master-builds/duckdb_r_src.tar.gz", repos = NULL)
  • Other Platforms: You can find binaries here or compile from source.
  • Have you tried the steps to reproduce? Do they include all relevant data and configuration? Does the issue you report still appear there?

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

@Mytherin The JDBC driver does not use Query. Everything goes through Prepare and Execute.

conn->Query(TABEL_DROP_SQL);

I ran this example (that I feel is close to the JDBC calls) and each query uses almost a 200 Bytes of extra memory.

#include "duckdb.hpp"
#include <iostream>

using namespace duckdb;

int main() {
	DuckDB db(nullptr);
	/* Connection con(db); */
    auto con = make_unique<Connection>(db);

	con->Query("create table t (id int8, texty varchar)");
	con->Query("insert into t values (1, 'uiae')");

    int i = 0;
    long total = 0;

    while (true)
    {
        auto stmt_ref = con->Prepare("select texty from t where id = 1;");
        vector<Value> duckdb_params;
        auto res_ref = stmt_ref->Execute(duckdb_params, false);
        
        i++;
        total++;

        if (i == 1000)
        {
            std::cout << "Total: " <<  total << std::endl;
            i = 0;
        }
    }
}

Hopefully someone can confirm this or point to a problem with the example.