Skip to content

Commit df6c724

Browse files
committed
Disable eager freeing of argument tuples
1 parent 92bc5d5 commit df6c724

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1217,6 +1217,12 @@ static boolean releaseArgsTuple(Object argsTupleObject, ReleaseNativeSequenceSto
12171217
* NativeSequenceStorageReference such that the NativeSequenceStorage will not leak.
12181218
*/
12191219
if (s instanceof NativeSequenceStorage nativeSequenceStorage) {
1220+
/*
1221+
* TODO we would like to release the memory already, but we currently can't tell
1222+
* if the args tuple escaped back to managed. So we always create the native
1223+
* storage with an ownership reference and the following condition is always
1224+
* true.
1225+
*/
12201226
if (nativeSequenceStorage.hasReference()) {
12211227
/*
12221228
* Not allocated by this root. Note that this can happen even when
@@ -2181,7 +2187,7 @@ static PTuple doCachedLenEagerNative(PythonObjectFactory factory, Object[] args,
21812187
for (int i = 0; i < cachedLen; i++) {
21822188
args[i] = materializePrimitiveNodes[i].execute(factory, args[i]);
21832189
}
2184-
return factory.createTuple(storageToNativeNode.execute(inliningTarget, args, cachedLen, false));
2190+
return factory.createTuple(storageToNativeNode.execute(inliningTarget, args, cachedLen, true));
21852191
}
21862192

21872193
@Specialization(replaces = {"doCachedLen", "doCachedLenEagerNative"})
@@ -2196,7 +2202,7 @@ static PTuple doGeneric(PythonObjectFactory factory, Object[] args, boolean eage
21962202
}
21972203
SequenceStorage storage;
21982204
if (eagerNative) {
2199-
storage = storageToNativeNode.execute(inliningTarget, args, n, false);
2205+
storage = storageToNativeNode.execute(inliningTarget, args, n, true);
22002206
} else {
22012207
storage = new ObjectSequenceStorage(args);
22022208
}

0 commit comments

Comments
 (0)