Repository navigation
Have MultiLibraryClassLoader instances keep their ClassLoader alive - #244
Conversation
60da3c9 to
07a96dd
Compare
|
Pulls: #244 |
|
Pulls: #244 |
07a96dd to
e35c665
Compare
MultiLibraryClassLoader kept every ClassLoader it created in a process-wide static vector so loaders survived while their instances were alive. Loaders whose instances outlived the MultiLibraryClassLoader stayed there until process exit, and without on-demand unloading their libraries were never unloaded. Own the loaders per MultiLibraryClassLoader instead, and have each instance hold a shared_ptr to its ClassLoader. A loader now lives exactly as long as its MultiLibraryClassLoader or its last instance, and the static vector and its destruction-order workaround go away. Signed-off-by: Michael Carroll <[email protected]>
e35c665 to
ef2608a
Compare
Create class_loader's global data when the library is loaded, so it outlives static loaders and instances destroyed at exit. Rewrite the exit test to cover both cases. Don't unload loaders that still have instances when a MultiLibraryClassLoader is destroyed; their last instance unloads the library, without the "SEVERE WARNING". Signed-off-by: Alejandro Hernandez Cordero <[email protected]>
|
Pulls: #244 |
CI Test Results
Linux — 3 failure(s)
Windows — 3 failure(s)
|
|
Update to the CI table above: the aarch64 build there (#24246) lost its agent and was restarted as #24255: 3 failed, 20562 passed. The failures are the same 3 as on Linux and Windows, all in rmw ( |
Description
MultiLibraryClassLoaderkept itsClassLoaders in a process-wide static vector. Loaders whose instances outlived theMultiLibraryClassLoaderwere never released, so their libraries were never unloaded, and a staticMultiLibraryClassLoaderread that vector after it was destroyed at exit (part of #33).Each
MultiLibraryClassLoadernow owns its loaders asshared_ptrs, and each instance it creates holds ashared_ptrto its loader. This removes the static vector and theClassLoaderDependencyworkaround.Is this user-facing behavior change?
No API change. ABI changes, so rolling only.
Did you use Generative AI?
Claude Code (Claude Opus 5.5) wrote the change; I reviewed it.
Additional Information
Follow-up to #240. New test
MultiClassLoaderTest.instanceOutlivesLoader; its non-lazy cases fail on rolling.