You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice if instead of a static variable, there was a mechanism to create a shared_ptr that is owned by the SendableRegistry (making it effectively a singleton) by name somehow. This would allow PRs like #7712 to not leak memory.
I'm not convinced this is a great idea, but I'd like to remove as many static globals as we can from the library for 2027, as it would make unit testing using a clean slate easier, and also simplify things for robotpy.
The text was updated successfully, but these errors were encountered:
I don't think it's realistic to remove static globals. They make the library more user friendly, as it avoids the need for users to keep around random variables. If we want to improve global cleanup of static variables, I think a better solution would be to import and use LLVM's ManagedStatic (https://github.com/llvm/llvm-project/blob/main/llvm/include/llvm/Support/ManagedStatic.h) anywhere where we currently use a magic or global static. We'd probably have to change the shutdown function to be thread-safe, but it's close to what we need. We should also probably write an equivalent of it for Java?
It would be nice if instead of a static variable, there was a mechanism to create a shared_ptr that is owned by the SendableRegistry (making it effectively a singleton) by name somehow. This would allow PRs like #7712 to not leak memory.
I'm not convinced this is a great idea, but I'd like to remove as many static globals as we can from the library for 2027, as it would make unit testing using a clean slate easier, and also simplify things for robotpy.
The text was updated successfully, but these errors were encountered: