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
Copy file name to clipboardExpand all lines: graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/transitions/CApiTransitions.java
+16-6Lines changed: 16 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -653,13 +653,20 @@ public static void deallocNativeReplacements(PythonContext context, HandleContex
653
653
IdReference<?> ref = iterator.next().getValue();
654
654
if (refinstanceofPythonObjectReferencereference) {
655
655
if (!reference.isAllocatedFromJava()) {
656
-
// This memory must be free from C
657
-
referencesToBeFreed.add(reference.pointer);
658
-
iterator.remove();
656
+
// This memory must be freed from C
657
+
if (subNativeRefCount(reference.pointer, MANAGED_REFCNT) == 0) {
658
+
// Only the managed references exist, we can dealloc
659
+
referencesToBeFreed.add(reference.pointer);
660
+
iterator.remove();
661
+
} else {
662
+
// There is a native reference which presumably will decref this one at a
0 commit comments