Comments (2)
What are you proposing @daohu527 ? IIUC RTLD_GLOBAL
is used to ensure RTTI (and dynamic_cast
) works, but it also means it won't get unloaded if a symbol within the executable space depends on a symbol in that loaded shared library. That why it goes to a "graveyard".
from class_loader.
I mean that even if dlopen
sets RTLD_GLOBAL
, it will be dynamically unloaded, including static variables.
We are divided into 2 situations to discuss
1 case
Some static variable with STB_GNU_UNIQUE
will still in memory when call dlclose
. you can ref to Destructor of a global static variable in a shared library is not called on dlclose.
There is not this case in below register code. (static variables in template classes and inline functions)
class_loader/include/class_loader/register_macro.hpp
Lines 41 to 52 in c012f77
2 case
Instructions in the man manual dlopen
not this case too.
RTLD_NODELETE (since glibc 2.2)
Do not unload the shared object during dlclose(). Consequently, the object's static and global variables are not reinitialized if the object is reloaded with dlopen() at a later time.
The following two descriptions may appear, unless the ros module can be referenced by ros module. we will explain in next subsection.
The dynamic linker maintains reference counts for object handles, so a dynamically loaded shared object is not deallocated until dlclose() has been called on it as many times as dlopen() has succeeded on it.
Symbols in this object might be required in another object because this object was opened with the RTLD_GLOBAL flag and one of its symbols satisfied a relocation in another object.
example
If A is an ros module and C is references A.
A // A is a ros module
C <- A // C references A
We first load A and then load C, the A module will Implicit load only once (reference counts
is 2) and register once, then if we unload the library A, the A will still in memory, because the dlopen reference counts
is 1, after that we load A again, and A will not register because A is already in memory.
reason
So the core principle is, can ROS modules be referenced by other ROS modules? But it is unreasonable to say that RTLD_GLOBAL
causes this problem.
from class_loader.
Related Issues (20)
- [ros2] Cannot find Poco on Windows HOT 1
- Memory leak: meta objects not destroyed HOT 3
- Progress toward Quality Level 1 HOT 3
- Link error with Poco when using libc++ HOT 1
- ClassLoaderTest.threadSafety test is noisy
- SEVERE WARNING!!! in tests
- Project 'class_loader' specifies '/include' as an include dir HOT 2
- Towards Quality Level 1 - Activate DCO
- Library/Dependency Detetction; Bug?
- mac ros build class_loader issue HOT 2
- ROS 2 Travis / AppVeyor CI broken
- Method createSharedInstance missing in ROS2 branches HOT 2
- Question: How to load library when dependencies are not in the LD_LIBRARY_PATH? HOT 2
- Can we have a 0.4.2 tag? HOT 4
- Is load_ref_count_ no need to count number?
- Unnecessary conditional judgment in isLibraryLoaded ? HOT 1
- undefined reference to `class_loader HOT 4
- Remove raw pointer interface HOT 2
- ROS independent builds with rolling release?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from class_loader.