Skip to content

Commit fa55f8e

Browse files
committed
Reset static symbol cache to avoid memleak
1 parent 7450b32 commit fa55f8e

File tree

1 file changed

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

1 file changed

+9
-0
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,15 @@ public void finalizeCapi() {
815815
for (Object pyMethodDefPointer : methodDefinitions.values()) {
816816
PyMethodDefHelper.free(pyMethodDefPointer);
817817
}
818+
/*
819+
* If the static symbol cache is not null, then it is guaranteed that this context instance
820+
* was the exclusive user of it. We can now reset the state such that other contexts created
821+
* after this can use it.
822+
*/
823+
if (CApiContext.nativeSymbolCacheSingleContext != null) {
824+
CApiContext.nativeSymbolCacheSingleContext = null;
825+
CApiContext.STATIC_SYMBOL_CACHE_USED.set(false);
826+
}
818827
}
819828

820829
@TruffleBoundary

0 commit comments

Comments
 (0)