**Describe the bug**
`SELECT i FROM generateRandom('i Array(Int8)', 1048575, 10, 1048577) LIMIT 1048575`

Memory limit should be respected.
{
    time_t min_first_write_time = std::numeric_limits<time_t>::max();
    time_t rows = 0;
    for (auto & buffer : buffers)
    {
        std::lock_guard lock(buffer.mutex);
        min_first_write_time = buffer.first_write_time;
        rows += buffer.data.rows();
    }
    
    if (!rows)
        return;
    time_t current_time = time(nullptr);
    time_t time_passed = current_time - min_first_write_time;
    size_t min = std::max<ssize_t>(min_thresholds.time - time_passed, 1);
    size_t max = std::max<ssize_t>(max_thresholds.time - time_passed, 1);
    flush_handle->scheduleAfter(std::min(min, max) * 1000);
}
void StorageBuffer::checkAlterIsPossible(const AlterCommands & commands, const Settings & ) const