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

Memory limit should be respected.
{
    try
    {
        LOG_TRACE(log, "Flushing system log, {} entries to flush", to_flush.size());
        
        
        
        
        prepareTable();
        Block block = LogElement::createBlock();
        MutableColumns columns = block.mutateColumns();
        for (const auto & elem : to_flush)
            elem.appendToBlock(columns);
        block.setColumns(std::move(columns));
        
        
        std::unique_ptr<ASTInsertQuery> insert = std::make_unique<ASTInsertQuery>();
        insert->table_id = table_id;
        ASTPtr query_ptr(insert.release());
        
        Context insert_context(context);
        insert_context.makeQueryContext();
        InterpreterInsertQuery interpreter(query_ptr, insert_context);
        BlockIO io = interpreter.execute();
        io.out->writePrefix();
        io.out->write(block);
        io.out->writeSuffix();
    }
    catch (...)