Std::malloc in HeapBlock


#1

I would like to make the proposal to replace std::malloc in HeapBlock with the new() operator.
Also there are only a few other occurrences: MidiMessage, PNGLoader. Thats all.
Shouldn’t be complicated, and than juce uses a single way to allocate memory.

Background:
I’m thinking about to replace the global new/delete operator

  • at the beginning for debug reasons (to spot allocations on the audio-callback)
  • maybe later to implement a very fast allocator

Any thoughts?


#2

Nah, can’t do that. An important feature of HeapBlock is that it offers realloc(), which you can’t do with the new operator. And an efficient realloc implementation is really important in making a lot of the juce containers run fast.


#3

Yes, that makes sense!