runtime: mark long lived objects with a special flag #17047
Labels
compiler/runtime
Issues related to the Go compiler and/or runtime.
FeatureRequest
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
Milestone
Hi,
I've been thinking on how to make finding memory leaks a bit easier for Go users.
I would like to ask if it's possible to introduce a runtime flag like
GODEBUG=gctrace=3
where the GC would "paint" the long lived objects that live over a long period of time in the memory of the program. Say this could be configured viaGODEBUG=gctrace=3,longlived=100s
which would express that the user sees the objects that are present for more than 100 seconds printed when the GC runs (the display can be done at a frequency of a few seconds apart so that it doesn't overload output in case of very large applications). An alternative would be maybe instead of a time span to configure a number of GC runs that would need to pass in order for an object to be considered old (but that would imply the user is very savvy about the GC, how it works and how the application should perform).I know this would imply a runtime penalty but when trying to find a memory leak performance is not the priority.
What do you think? Would this be possible? If you need further details to clarify this please let me know.
Thank you.
The text was updated successfully, but these errors were encountered: