[cling] teardown: correctly free frontend and retained JITLink allocations - #23045
[cling] teardown: correctly free frontend and retained JITLink allocations#23045aaronj0 wants to merge 2 commits into
Conversation
d604721 to
d4b017a
Compare
|
Can you confirm root actually calls the cling interpreter destructor? |
|
|
@smuzaffar can you check this pr in cmssw? |
d4b017a to
e5bb010
Compare
|
force updated to trigger the CI which was down previously |
Test Results 21 files 21 suites 3d 8h 55m 16s ⏱️ For more details on these failures, see this check. Results for commit e5bb010. |
@vgvassilev , cmssw tests passed. There are few unit test failures but they are not related to this change |
Thank you, @smuzaffar! |
Based on the CppInterOp cling+ASan CI job running tests that create and destroy several interpreters per process, and LSan reports two leaks there:
In JITLink, with the upgrade to LLVM22,
EHFrameRegistrationPluginnow pushes a deregistrationWrapperFunctionCallinto each allocation'sFinalizedAllocInfo::DeallocActionsvector. Our deallocate retains the code viaFinalizedAlloc::release(), which orphans that vector's heap buffer.For the frontend:
ShutDown()leaks Sema/ASTContext through the DisableFree path and hides the pointers withllvm::BuryPointe. Its fixed buffer only holds 16 pointers, so once a process destroys a few interpreters it overflows and LSan starts reporting whole frontends, normally with a single interpreter until process exit would not hit this.