I’m running into an issue with HeapBlock malloc/calloc/realloc/allocate/free. We have our own memory debugger which defines its own versions of malloc etc., but juce_HeapBlock.h undefines those macros in order to use the names for member functions. Wouldn’t it be wiser to just name the functions something else (like hb_malloc) so that Juce doesn’t stomp on user defined malloc etc.?
In C++, the standard solution to avoid name clashes is namespaces.
I noticed that, when you include <juce.h> there’s an “using namespace JUCE_NAMESPACE;” added to your code. You can remove it by replacing
#define DONT_SET_USING_JUCE_NAMESPACE #include <juce.h>
Maybe it’s worth a try ?
However, every reference to juce library will nbow have to be prefixed by juce:: which can be a pain in the neck if you have a lot of code
will have to become :
The easy fix would presumably just be to include your own header after juce.h (or just to redefine those macros after including it). That’s pretty trivial to do.
But I’d recommend the smarter approach of spending an hour or two removing malloc and free from all your code, in favour of something like HeapBlock. That way, you’d probably no longer need a memory debugger at all…