Core Audio glitching

Hi all, I have a plugin that can take a high amount of CPU depending on the parameters set in the plugin.

I noticed that in a DAW setting the plugin will have pops/clicks if the CPU is high enough. In the standalone app, I get weird glitches and buzzing (sounds like a buffer is repeating itself over and over). I traced the problem to juce_mac_CoreAudio.cpp producing the repetitive glitching.

In juce_mac_CoreAudio.cpp we have

            callback->audioDeviceIOCallbackWithContext (getTempBuffers (inStream),  numInputChans,
                                                        getTempBuffers (outStream), numOutputChans,
                                                        { timeStamp != nullptr ? &nanos : nullptr });

If i change the last argument to { nullptr }, i get no repetitive glitching, just pops and clicks at very high CPU, similar to how my DAW behaves. I see that this line calls the function

        void audioDeviceIOCallbackWithContext (const float* const* inputChannelData,
                                               int numInputChannels,
                                               float* const* outputChannelData,
                                               int numOutputChannels,
                                               int numSamples,
                                               const AudioIODeviceCallbackContext& context) override

I see in that function we use the context to update the sample position in updateSampleTimeFromContext (context); I suspect that this is causing the problem. Can anyone explain this?