hydra icon indicating copy to clipboard operation
hydra copied to clipboard

Fix memory leak when updating chunk skip node

Open japinli opened this issue 10 months ago • 0 comments

When UpdateChunkSkipNodeMinMax() is executed, it may allocate memory for non-fixed size data types. If the minimum or maximum value changes, the previous value will be overwritten, resulting in a memory leak.

For example:

CREATE TABLE t (id serial, data text) USING columnar;
INSERT INTO t SELECT 1, repeat('a', 255000000);
INSERT INTO t SELECT 2, repeat('b', 255000000);
INSERT INTO t SELECT 3, repeat('c', 255000000);
INSERT INTO t SELECT 4, repeat('d', 255000000);
INSERT INTO t SELECT 5, repeat('e', 255000000);
INSERT INTO t SELECT 6, repeat('f', 255000000);

Patched reduced memory usage from 3.6G to 3.0G (top's RES) when running VACUUM t.

japinli avatar Apr 03 '24 05:04 japinli