HeapBlock calloc and Clearing Memory

Is this code redundant?

HeapBlock<float> buffer;
zeromem (buffer, sizeof (float) * someSize);

The documentation says .calloc() “clears” memory. I am assuming this means it is setting everything in that block of memory to zeroes. So, because calloc already clears the memory, I shouldn’t need to call zeromem to set the memory to all zeroes again, right?

From what I can tell, I only need the first two lines to allocate a block of memory and have it initialized to all zeroes.


Yeah, no need for zeromem. HeapBlock provides a clear() method, but you can initialise to zero using:

HeapBlock<float> buffer (someSize, true);