Skip to content

Commit

Permalink
Fix memory leak in Callback.free
Browse files Browse the repository at this point in the history
  • Loading branch information
kb-1000 authored Sep 29, 2023
1 parent e698513 commit 444f34c
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ public static void free(long functionPointer) {
MemoryManage.DebugAllocator.untrack(functionPointer);
}

FFIClosure closure = CLOSURE_REGISTRY.get(functionPointer);
FFIClosure closure = CLOSURE_REGISTRY.remove(functionPointer);

DeleteGlobalRef(closure.user_data());
ffi_closure_free(closure);
Expand Down Expand Up @@ -234,4 +234,4 @@ public String toString() {
return String.format("%s pointer [0x%X]", getClass().getSimpleName(), address);
}

}
}

0 comments on commit 444f34c

Please sign in to comment.