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

Memory limit should be respected.
if (to_flush.empty())
            {
                bool force;
                {
                    std::lock_guard lock(mutex);
                    force = is_force_prepare_tables;
                }
                if (force)
                {
                    prepareTable();
                    LOG_TRACE(log, "Table created (force)");
                    std::lock_guard lock(mutex);
                    is_force_prepare_tables = false;
                    flush_event.notify_all();
                }
            }
            else
            {
                flushImpl(to_flush, to_flush_end);
            }
        }
        catch (...)
        {
            tryLogCurrentException(__PRETTY_FUNCTION__);
        }
    }
    LOG_TRACE(log, "Terminating");
}
template <typename LogElement>
void SystemLog<LogElement>::flushImpl(const std::vector<LogElement> & to_flush, uint64_t to_flush_end)