Hi,
I am trying to build a plugin based on EngineInPlugin demo and was facing performance issues. When I investigated memory allocations I found that tracktion allocates memory on every call to processBlock. I built the latest version of the demo plugin (develop branch) and got the same results there.
The issue seems to be realted to an allocation of a vector of Nodes (see attached screenshot with call stack).
I’m sure this is not supposed to be called on every processBlock and there’s some configuration that will solve it. Also, I tested it in different hosts and got the same result.
I had a quick look and this only happens in debug builds:
inline void Node::prepareForNextBlock (juce::Range<int64_t> referenceSampleRange)
{
// Only do this once as prepare may be called multiple times
if (retainCount == 0)
{
assert (directInputNodes.size() == getDirectInputNodes().size());
I think I’ll just delete the check though as it’s not really thread-safe to call it there.
Thanks for the speedy response! I don’t see allocations anymore but unfortunalty I’m still struggling to build my project with tracktion engine v3 so I can’t see if the performance issue is gone
@dave96 Now I see memory allocation coming from the built in sampler plugin, which allocates new SampledNote every time. Is that some misuse of that plugin?
Anyway, it is not the main thing so I understand if I have to implement it differently for use in EngineInPlugin.
Tracktion Engine is only a few years old but Tracktion the DAW is nearly 25 years old now. 2000 or 2001 I think the first version was.
I also just had a quick look at this and seems like it will be harder than expected as the LagrangeInterpolator isn’t copyable or movable. We might have to use a trick like a std::shared_ptr (and a pointer for the AudioBuffer reference).