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

Memory limit should be respected.
{
    std::unique_lock lock(mutex);
    if (is_shutdown)
        return;
    const uint64_t queue_end = queue_front_index + queue.size();
    is_force_prepare_tables = force;
    if (requested_flush_before < queue_end || force)
    {
        requested_flush_before = queue_end;
        flush_event.notify_all();
    }
    
    const int timeout_seconds = 60;
    bool result = flush_event.wait_for(lock, std::chrono::seconds(timeout_seconds),
        [&] { return flushed_before >= queue_end && !is_force_prepare_tables; });
    if (!result)
    {
        throw Exception("Timeout exceeded (" + toString(timeout_seconds) + " s) while flushing system log '" + demangle(typeid(*this).name()) + "'.",
            ErrorCodes::TIMEOUT_EXCEEDED);
    }
}
template <typename LogElement>
void SystemLog<LogElement>::stopFlushThread()