Browse Source

Don't use leak detection on release builds

tags/1.9.7
falkTX 9 years ago
parent
commit
12bfd1ca61
2 changed files with 15 additions and 4 deletions
  1. +5
    -1
      source/modules/juce_core/AppConfig.h
  2. +10
    -3
      source/utils/CarlaJuceUtils.hpp

+ 5
- 1
source/modules/juce_core/AppConfig.h View File

@@ -39,7 +39,11 @@
Enables a memory-leak check for certain objects when the app terminates. See the LeakedObjectDetector
class and the JUCE_LEAK_DETECTOR macro for more details about enabling leak checking for specific classes.
*/
#define JUCE_CHECK_MEMORY_LEAKS 1
#ifdef DEBUG
#define JUCE_CHECK_MEMORY_LEAKS 1
#else
#define JUCE_CHECK_MEMORY_LEAKS 0
#endif
//=============================================================================
/** Config: JUCE_DONT_AUTOLINK_TO_WIN32_LIBRARIES


+ 10
- 3
source/utils/CarlaJuceUtils.hpp View File

@@ -27,6 +27,7 @@
#define CARLA_JOIN_MACRO_HELPER(a, b) a ## b
#define CARLA_JOIN_MACRO(item1, item2) CARLA_JOIN_MACRO_HELPER(item1, item2)

#ifdef DEBUG
/** This macro lets you embed a leak-detecting object inside a class.
To use it, simply declare a CARLA_LEAK_DETECTOR(YourClassName) inside a private section
of the class declaration. E.g.
@@ -42,14 +43,20 @@
};
@endcode
*/
#define CARLA_LEAK_DETECTOR(ClassName) \
# define CARLA_LEAK_DETECTOR(ClassName) \
friend class ::LeakedObjectDetector<ClassName>; \
static const char* getLeakedObjectClassName() noexcept { return #ClassName; } \
::LeakedObjectDetector<ClassName> CARLA_JOIN_MACRO(leakDetector_, ClassName);

#define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \
CARLA_DECLARE_NON_COPY_CLASS(ClassName) \
# define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \
CARLA_DECLARE_NON_COPY_CLASS(ClassName) \
CARLA_LEAK_DETECTOR(ClassName)
#else
/** Don't use leak detection on release builds. */
# define CARLA_LEAK_DETECTOR(ClassName)
# define CARLA_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ClassName) \
CARLA_DECLARE_NON_COPY_CLASS(ClassName)
#endif

//=====================================================================================================================
/**


Loading…
Cancel
Save