Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime: mark long lived objects with a special flag #17047

Open
dlsniper opened this issue Sep 9, 2016 · 2 comments
Open

runtime: mark long lived objects with a special flag #17047

dlsniper opened this issue Sep 9, 2016 · 2 comments
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

Comments

@dlsniper
Copy link
Contributor

dlsniper commented Sep 9, 2016

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 via GODEBUG=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.

@randall77
Copy link
Contributor

I suspect this proposal is a bit of overkill to find memory leaks. If you have a serious memory leak (actual heap size >> heap size you expect), a random live object is old with good probability.

@randall77 randall77 added this to the Unplanned milestone Sep 9, 2016
@dlsniper
Copy link
Contributor Author

@randall77 thanks for your reply.

That is true, probably it's going to be a bit too much / too noisy. On the other hand, I can't think of another way to make things easier to spot when leaks happen. I'd be happy with having a list of objects that I can then instruct whatever tool will handle this output to ignore as I can mark them as such.

But if there are better ways to achieve this then that would be good as well.

@ALTree ALTree changed the title Mark long lived objects with a special flag runtime: mark long lived objects with a special flag Sep 22, 2018
@ALTree ALTree added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Sep 22, 2018
@gopherbot gopherbot added the compiler/runtime Issues related to the Go compiler and/or runtime. label Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

4 participants