-
Notifications
You must be signed in to change notification settings - Fork 175
Open
Description
What happens?
When creating tables via function insertArrowTable the memory is leaked (not released nor reusable) when the table is dropped.
Memory of tables created directly in duckdb is not released (according to #1904 ) but is reusable after table is dropped
To Reproduce
Consider the following test that inserts new tables and drops them as soon as are created:
for (let i = 0; i < 100; i++) {
conn = await db.connect();
const table = arrow.tableFromArrays({
a: Int32Array.from({ length: 1000000 }, (_, i) => i),
b: Int32Array.from({ length: 1000000 }, (_, i) => i),
c: Int32Array.from({ length: 1000000 }, (_, i) => i),
});
await conn.insertArrowTable(table, { name: `insert_from_vectors_${i}`, create: true });
await conn.query(`DROP TABLE IF EXISTS insert_from_vectors_${i}`);
await conn.close();
await db.flushFiles();
await db.dropFiles();
await db.flushFiles();
}
You can check from dev tools that the memory used always increases.
On the other hand, creating the table in duckdb the memory increases just once:
for (let i = 0; i < 100; i++) {
conn = await db.connect();
await conn.query(`CREATE TABLE insert_from_vectors_${i} AS SELECT random() AS value FROM range(1, 10000000)`);
await conn.query(`DROP TABLE IF EXISTS insert_from_vectors_${i}`);
await conn.close();
await db.flushFiles();
await db.dropFiles();
await db.flushFiles();
}
and according #1904 is never releaesd.
Browser/Environment:
Chrome 141
Device:
PC
DuckDB-Wasm Version:
1.31
DuckDB-Wasm Deployment:
self
Full Name:
Arrigo Zanette
Affiliation:
Corvina srl
Metadata
Metadata
Assignees
Labels
No labels