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

what about memory? #28

Open
ahdyt opened this issue Mar 3, 2024 · 5 comments
Open

what about memory? #28

ahdyt opened this issue Mar 3, 2024 · 5 comments

Comments

@ahdyt
Copy link

ahdyt commented Mar 3, 2024

Hi there, first of all, thank you for this good package, it helps me profling cpu better than have to run go tool pprof multiple times. I was just wondering if this will also support memory/heap profiling?

@cristaloleg
Copy link
Contributor

What is wrong with the standard memory profiler?

@ahdyt
Copy link
Author

ahdyt commented Mar 3, 2024

The standard memory profiler only catch the last stack/gc/action, for an item that is already GCed it's not showed. I would like to keep every action and if it's GCed the diagram shows GCed.

Illustration:

  1. gops pprof-heap
  2. visit url /
  3. visit url /high-computation
  4. visit url /example
  5. dump to svg

The svg file only shows the last visit url /example memory usage, rather than capturing entire actions(visit url /, visit url /high-computation, visit url /example).

@felixge
Copy link
Owner

felixge commented Mar 3, 2024

I'm not planning to add memory profiling to fgprof, but I think what you're looking for is a simple subtraction: alloc profile - heap inuse profile, that would show you the allocations since the start of the process that have since been GC'ed. The heap inuse profile shows you what remains after the most recent GC.

That being said, I don't know why such a profile would be useful.

@ahdyt
Copy link
Author

ahdyt commented Mar 3, 2024

Alright, I will search how to do the substraction of initial alloc and inuse heap.

This kind of profiling maybe good for catching any possibilities of memory leak or GC leftovers, especially in Go map struct.

@felixge
Copy link
Owner

felixge commented Mar 3, 2024

I don't think you need this kind of analysis for understanding memory leaks. You just need to watch if the heap inuse profile is increasing in size. I've described this in more detail here: https://www.datadoghq.com/blog/go-memory-metrics/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants