Skip to content

Memory is not returned when ENGINE=Memory table is dropped #9248

@Akazz

Description

@Akazz

Describe the bug or unexpected behaviour
Memory is not returned when a table with ENGINE=Memory is dropped!

How to reproduce

  • ClickHouse server version 20.+
  • Running the following snippet will waste around 4Gb of RAM
CREATE DATABASE IF NOT EXISTS test_memory_leak
CREATE TABLE test_memory_leak.table1 (x1 UInt8) ENGINE = Memory
INSERT INTO test_memory_leak.table1 SELECT materialize(0) AS x1 FROM numbers(4000000000)

SELECT 1

TRUNCATE TABLE test_memory_leak.table1
DROP TABLE test_memory_leak.table1
DROP DATABASE test_memory_leak
  • Running it in a loop eventually gets ClickHouse server OOMed

Metadata

Metadata

Labels

memoryWhen memory usage is higher than expected

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions