@@ -1217,6 +1217,12 @@ static boolean releaseArgsTuple(Object argsTupleObject, ReleaseNativeSequenceSto
1217
1217
* NativeSequenceStorageReference such that the NativeSequenceStorage will not leak.
1218
1218
*/
1219
1219
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
+ */
1220
1226
if (nativeSequenceStorage .hasReference ()) {
1221
1227
/*
1222
1228
* Not allocated by this root. Note that this can happen even when
@@ -2181,7 +2187,7 @@ static PTuple doCachedLenEagerNative(PythonObjectFactory factory, Object[] args,
2181
2187
for (int i = 0 ; i < cachedLen ; i ++) {
2182
2188
args [i ] = materializePrimitiveNodes [i ].execute (factory , args [i ]);
2183
2189
}
2184
- return factory .createTuple (storageToNativeNode .execute (inliningTarget , args , cachedLen , false ));
2190
+ return factory .createTuple (storageToNativeNode .execute (inliningTarget , args , cachedLen , true ));
2185
2191
}
2186
2192
2187
2193
@ Specialization (replaces = {"doCachedLen" , "doCachedLenEagerNative" })
@@ -2196,7 +2202,7 @@ static PTuple doGeneric(PythonObjectFactory factory, Object[] args, boolean eage
2196
2202
}
2197
2203
SequenceStorage storage ;
2198
2204
if (eagerNative ) {
2199
- storage = storageToNativeNode .execute (inliningTarget , args , n , false );
2205
+ storage = storageToNativeNode .execute (inliningTarget , args , n , true );
2200
2206
} else {
2201
2207
storage = new ObjectSequenceStorage (args );
2202
2208
}
0 commit comments