(you don't have to strictly follow this form)

**Describe the bug**
The following query leads to OOM if server was built with thread sanitizer.

```sql
SELECT range(65535) FROM system.one ARRAY JOIN range(65536) AS number

#pragma once
#include <DataStreams/IBlockOutputStream.h>
#include <common/types.h>
#include <DataTypes/IDataType.h>
namespace DB
{
class WriteBuffer;
class CompressedWriteBuffer;
/** Serializes the stream of blocks in their native binary format (with names and column types).
  * Designed for communication between servers.
  *
  * A stream can be specified to write the index. The index contains offsets to each part of each column.
  * If an `append` is made to an existing file, and you need to write the index, then specify `initial_size_of_file`.
  */
class NativeBlockOutputStream : public IBlockOutputStream