# Malloc/new in getNextAudioBlock

**URL:** <https://forum.juce.com/t/malloc-new-in-getnextaudioblock/12701>\
**Category:** General JUCE discussion\
**Created:** [April 14, 2014, 6:56pm UTC](https://forum.juce.com/t/malloc-new-in-getnextaudioblock/12701 "2014-04-14T18:56:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![RolandMR](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/rolandmr/32/641_2.png) [@RolandMR](https://forum.juce.com/u/RolandMR)\
**Post date:** [April 14, 2014, 6:56pm UTC](https://forum.juce.com/t/malloc-new-in-getnextaudioblock/12701/1 "2014-04-14T18:56:01Z")

</div>

I just noticed this comment:

> // (try to avoid doing a malloc here, as that'll blow up things like Pro-Tools)

Obviously I try and avoid malloc/new in the audio thread since it can be a rather slow. But every once and a while I use a std::vector or an Array to pass events in/out of the audiothread. What will happen if std::vector or Array does a malloc/new internally? Will it crash Pro-Tools / &nbsp;other hosts?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [April 14, 2014, 7:01pm UTC](https://forum.juce.com/t/malloc-new-in-getnextaudioblock/12701/2 "2014-04-14T19:01:31Z")

</div>

It won't actually crash anything, but it can cause a glitch. But yeah, I know, it's often just not practical to avoid allocation completely..
