You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For all kinds of table writers (Java code: Table.java, JNI code: TableJni.cpp), the native C++ instances are never destroyed after calling close() in the corresponding Java classes. For example:
@Override
public void close() throws CudfException {
if (writerHandle != 0) {
writeParquetEnd(writerHandle);
}
writerHandle = 0;
Note that state is an unmanaged pointer that corresponds to writerHandle in Java and stores writer as a unique_ptr. So the writer instance is destroyed automatically when state is destroyed, however, state is never destroyed.
When writeParquetEnd is called, the C++ code only calls the member close() function of the writer, never calls delete on the state instance. After this, the Java code simply leaves that native instance dangled.
The text was updated successfully, but these errors were encountered:
ttnghia
changed the title
[BUG] [Java] Memory leak due to table writers are never destroyed
[BUG] [Java] Memory leak due to table writers never being destroyed after done writing
Jan 11, 2025
For all kinds of table writers (Java code:
Table.java
, JNI code:TableJni.cpp
), the native C++ instances are never destroyed after callingclose()
in the corresponding Java classes. For example:And here is the C++ function
writeParquetEnd
:Note that
state
is an unmanaged pointer that corresponds towriterHandle
in Java and storeswriter
as aunique_ptr
. So thewriter
instance is destroyed automatically whenstate
is destroyed, however,state
is never destroyed.When
writeParquetEnd
is called, the C++ code only calls the memberclose()
function of the writer, never callsdelete
on thestate
instance. After this, the Java code simply leaves that native instance dangled.The text was updated successfully, but these errors were encountered: