DSPFilters4JUCEDemo/JuceLibraryCode/modules/juce_core/memory/juce_MemoryBlock.cpp
void MemoryBlock::setSize (const size_t newSize, const bool initialiseToZero)
{
    if (size != newSize)
    {
        if (newSize <= 0)
        {
            reset();
        }
        else
        {
            if (data != nullptr)
            {
                data.realloc (newSize);

                if (initialiseToZero && (newSize > size))
                    zeromem (data + size, newSize - size);
            }
            else
            {
                data.allocate (newSize, initialiseToZero);
            }

            size = newSize;
        }
    }
}
//==============================================================================
// this will resize the block to this size

this will resize the block to this size
this will resize the block to this size
void MemoryBlock::setSize (const size_t newSize, const bool initialiseToZero)
{
    if (size != newSize)
    {
        if (newSize <= 0)
        {
            reset();
        }
        else
        {
            if (data != nullptr)
            {
                data.realloc (newSize);
                if (initialiseToZero && (newSize > size))
                    zeromem (data + size, newSize - size);
            }
            else
            {
                data.allocate (newSize, initialiseToZero);
            }
            size = newSize;
        }
    }
}
void MemoryBlock :: setSize ( const size_t newSize , const bool initialiseToZero ) { if ( size != newSize ) { if ( newSize <= 0 ) { reset ( ) ; } else { if ( data != nullptr ) { data . realloc ( newSize ) ; if ( initialiseToZero && ( newSize > size ) ) zeromem ( data + size , newSize - size ) ; } else { data . allocate ( newSize , initialiseToZero ) ; } size = newSize ; } } }
this will resize the block to this size
this will resize the block to this size