Skip to content

Commit

Permalink
Require to implement AutoCloseable for the classes derived from `Ho…
Browse files Browse the repository at this point in the history
…stUDFWrapper` (#17727)

This adds the requirement to implement `AutoCloseable`  to the classes derived from `HostUDFWrapper`, forcing them to delete the native UDF instance upon class destruction. Doing so will fix the memory leak issue when the native UDF instance never being destroyed.

Authors:
  - Nghia Truong (https://github.com/ttnghia)

Approvers:
  - Robert (Bobby) Evans (https://github.com/revans2)

URL: #17727
  • Loading branch information
ttnghia authored Jan 14, 2025
1 parent f84cd43 commit 253fb2f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion java/src/main/java/ai/rapids/cudf/HostUDFWrapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
* <p>
* A new host UDF aggregation implementation must extend this class and override the
* {@code hashCode} and {@code equals} methods for such purposes.
* In addition, since this class implements {@code AutoCloseable}, the {@code close} method must
* also be overridden to automatically delete the native UDF instance upon class destruction.
*/
public abstract class HostUDFWrapper {
public abstract class HostUDFWrapper implements AutoCloseable {
public final long udfNativeHandle;

public HostUDFWrapper(long udfNativeHandle) {
Expand Down

0 comments on commit 253fb2f

Please sign in to comment.