You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Oct 23, 2026. It is now read-only.
Limit keyword not release memory after delete oldest metrics. #763
Hi @jaqx0r, I set the Limit keyword so mtail will remove the oldest metrics, but I noticed the memory usage of mtail process will increase and not decrease after GC.
m.labelValuesMap type is map[string]*LabelValue, the delete will not shrink the map size. see golang/go#20135
If someone uses the Limit keyword, it means that the number of metrics he wants to limit may be very large. Do we need to consider the memory consumption of this part?
I changed the m.labelValuesMap type to map[[256]byte]*LabelValue, because golang will allocates data more than 128 bytes from heap and save pointers in the bucket of map, and after GC pointers at map will be replaced by nil pointer, so the memory pointed will be recollected. This solution may have some unconsidered issues, just for reference.
Activity
zhengtianbao commentedon Sep 4, 2023
jaqx0r commentedon Apr 21, 2024
The second comment is probably a bug, can you open a new issue about it?
Thanks for the tip about the first issue.