3 ms·
Definitely agree option of a memory limit would be handy in a lot of cases. Sometimes a box exists to run one service and you know you want like 75% of the box'
by twotwotwo 9y ago
Definitely agree option of a memory limit would be handy in a lot of cases. Sometimes a box exists to run one service and you know you want like 75% of the box's RAM (leaving some for cache, other procs, etc.). Other times, like this, you don't want GOGC=100's frequent collections but also don't want the risk of an explosion if live data increases.
Just adding some heuristics to override GOGC's behavior in extreme cases could help, e.g. assume by default OK to use 1% of system RAM and not OK to use >75% of it regardless of live data. I'm not sure we can realistically hope to get that--adds complexity, folks dislike arbitrary thresholds, and any change will break users who have optimized around current behavior. It might be you could approximate the desired behavior for reasonably well-behaved programs from a third-party package using runtime methods and a timer, but that's a drag.