Closed jcelerier closed 2 years ago
I only enable it for Linux then.
I fixed some memory leaks with the latest patches. However I didn't take care and my IDE changed all the tabs to space :( Here are the relevant changes : https://github.com/jamoma/JamomaCore/pull/392/files?w=1
Is this one ready for review/merge @jcelerier ? If so I guess it should be assigned to @theod because of changes in the NodeLib...
Glad you caught the mem leaks!
I see that the TTEnvironment was upgraded to a std::unique_ptr. I guess this is so that it is deleted on exit because it was showing up in your mem leak analysis? Seems like it could ideally be updated to something like a Meyer singleton, but maybe that's too much work for too little benefit now?
I just have to check that it didn't break anything WRT Max and Windows and it'll be good for a review.
A Meyer singleton is definitely in the realm of the possible, it will just take a few more days but it's overall better. There are still a few things showing up in valgrind too (in NodeLib::init iirc) which I want to fix.
Happy new year :)
I started working on it. However I encounter a small problem :
given
TTEnvironment& ttEnvironment()
{
static TTEnvironment env;
return env;
}
in TTObjectBase
there are some methods that end up calling ttEnvironment()
.
For now it looks like this does not happen during the construction of the TTEnvironment
's TTObjectBase
parent, but if someone was to call registerMessage(...)
or logDebugBasic(...)
in the ctor of TTObjectBase
it would crash with a recursive initialization fault.
There is the same problem in TTEnvironment
's constructor which calls addMessageWithArguments(...)
.
However this can be solved by adding an init() method that would be called at the place where the TTEnvironment* is currently constructed, in TTFoundationInit
.
Thanks for investigating @jcelerier.
Since we create an instance of TTEnvironment
toward the beginning of TTFoundationInit()
already, that should mean that aren't introducing any new possibilities for this recursion to take place. For that reason I think it is safe to do.
However, the issue you point out is certainly a design flaw and it seems we should maybe document or ticket that? What do you think?
This pull request has gone stale.
This is not ready to be merged, I have to test on Windows and OS X before. It's relative to the exchanged mails on the jamoma list.
For instance running ./test_JamomaFoundation with a Jamoma built with :
cmake -GNinja -DCMAKE_BUILD_TYPE=Debug -DJAMOMA_LIBCXX_DEBUG:Bool=True -DJAMOMA_SANITIZE_UNDEFINED:Bool=True ../JamomaCore
yields :
note: there are some false positives, especially with dynamic libs.