Commit graph

1 commit

Author SHA1 Message Date
Bryan Boreham 4ced6d5f40 compactor: avoid memory blow-up with stringlabels
When compiled with `-tags stringlabels`, the names and values point into
a larger block of memory containing all labels. Garbage-collection
considers the entire block "live" if you point to a part of it, so the
map ends up retaining all labels for (nearly) all series.

Cloning the string value avoids this problem, and we check first if the
value is already in the map. Since the clone is more expensive, only do
it when built with `-tags stringlabels`.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
2023-07-29 10:20:25 +01:00