Skip to content

Commit db40747

Browse files
committed
fix a memory leak in ToSulongNode, ToNewRefNode, and ToBorrowedRefNode
1 parent 4acc34f commit db40747

File tree

1 file changed

+4
-4
lines changed
  • graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi

1 file changed

+4
-4
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/CExtNodes.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,9 +434,9 @@ static Object doSingleton(@SuppressWarnings("unused") CExtContext cextContext, @
434434
return nativeWrapper;
435435
}
436436

437-
@Specialization(guards = "object == cachedObject", limit = "3")
437+
@Specialization(guards = "object == cachedObject", limit = "3", assumptions = "singleContextAssumption()")
438438
static Object doPythonClass(@SuppressWarnings("unused") CExtContext cextContext, @SuppressWarnings("unused") PythonManagedClass object,
439-
@SuppressWarnings("unused") @Cached("object") PythonManagedClass cachedObject,
439+
@SuppressWarnings("unused") @Cached(value = "object", weak = true) PythonManagedClass cachedObject,
440440
@Cached("wrapNativeClass(object)") PythonClassNativeWrapper wrapper) {
441441
return wrapper;
442442
}
@@ -690,7 +690,7 @@ static Object doSingleton(@SuppressWarnings("unused") CExtContext cextContext, @
690690
return nativeWrapper;
691691
}
692692

693-
@Specialization(guards = "object == cachedObject", limit = "3")
693+
@Specialization(guards = "object == cachedObject", limit = "3", assumptions = "singleContextAssumption()")
694694
static Object doPythonClass(@SuppressWarnings("unused") CExtContext cextContext, @SuppressWarnings("unused") PythonManagedClass object,
695695
@SuppressWarnings("unused") @Cached("object") PythonManagedClass cachedObject,
696696
@Cached("wrapNativeClass(object)") PythonClassNativeWrapper wrapper) {
@@ -873,7 +873,7 @@ static Object doSingleton(CExtContext cextContext, PythonAbstractObject object,
873873
return ToNewRefNode.doSingleton(cextContext, object, contextRef);
874874
}
875875

876-
@Specialization(guards = "object == cachedObject", limit = "3")
876+
@Specialization(guards = "object == cachedObject", limit = "3", assumptions = "singleContextAssumption()")
877877
static Object doPythonClass(@SuppressWarnings("unused") CExtContext cextContext, @SuppressWarnings("unused") PythonManagedClass object,
878878
@SuppressWarnings("unused") @Cached("object") PythonManagedClass cachedObject,
879879
@Cached("wrapNativeClass(object)") PythonClassNativeWrapper wrapper) {

0 commit comments

Comments
 (0)