Header files order and heap leaking


Hi community,

I have perceived that if I change the order of the inckude header files, especially related to Juce.h, there is the chance that some data in the heap is detected by Jucer as leaked (despite they are conveniently deleted).

So, can somebode give some guidelines about this fact and why it occurs. I think it is due to a static members but I cannot figure out how.

Thank you,



This has everything to do with the order of destruction of objects with static storage duration. Function level statics, file level statics, and global variables all contribute. The problem happens when the corresponding LeakDetector object for a particular class gets destroyed while there are still instances of that object with static storage duration.

The only meaningful solution to this problem, which Jules objects to, is to stop using objects with static storage duration. I have created a class called a SharedSingleton which solves this problem completely. But it requires that all objects in the system use the SharedSingleton instead of a file, function, or global variable.

The SharedSingleton works together with the PerformedAtExit class to make sure that all the singletons are destroyed before the leak checking counters.


This makes sense.

I think this could be the problem that I have trying to compatibilize Steiberg's ASIO SDK Headers with Juce.

BTW, does anybady have any experience in that? Any help will be tremendously greeted.

Nevertheless, I'll take an eye to your libraries, Vinn.