SOLVED AudioBuffer<float> leaks after utilizing ::makeCopyOf() method

I have a class with a private member variable AudioBuffer. If I construct and deconstruct an object of the class, there is no error. However, if I use ::makeCopyOf() to copy the contents of an existing external buffer to the private member and then deconstruct the object, JUCE reports a memory leak. This is despite calling ::clear() in the destructor method of the class in question. I encountered the same problem when passing a buffer in by assignment as an alternative to using the ::makeCopyOf() method. What do I need to do to prevent the leak? There must be some way of copying an external buffer into my private member that doesn’t cause this error…


Nevermind! It wasn’t the buffer that was the problem. The whole object was leaking but only the buffer reported the leak. Red herring.

1 Like