Skip to content

Commit 6a6becd

Browse files
committed
Add specialization for NativePointer in FreeNode
1 parent 249c211 commit 6a6becd

File tree

1 file changed

+6
-1
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/structs

1 file changed

+6
-1
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/structs/CStructAccess.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,10 +199,15 @@ static void freeLong(long pointer) {
199199
UNSAFE.freeMemory(pointer);
200200
}
201201

202+
@Specialization
203+
static void freeNativePointer(NativePointer pointer) {
204+
UNSAFE.freeMemory(pointer.asPointer());
205+
}
206+
202207
@Specialization(guards = {"!isLong(pointer)", "lib.isPointer(pointer)"}, limit = "3")
203208
static void freePointer(Object pointer,
204209
@CachedLibrary("pointer") InteropLibrary lib) {
205-
freeLong(asPointer(pointer, lib));
210+
UNSAFE.freeMemory(asPointer(pointer, lib));
206211
}
207212

208213
@Specialization(guards = {"!isLong(pointer)", "!lib.isPointer(pointer)"})

0 commit comments

Comments
 (0)