Created
January 23, 2024 11:33
-
-
Save RolandWarburton/85e4b3ccd464fa21c8419eea69e7b06e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// go tool pprof mem_profile.pprof | |
func dumpMemoryProfile() { | |
memProfileFile, err := os.Create("mem_profile.pprof") | |
if err != nil { | |
log.Fatal("Could not create memory profile file: ", err) | |
} | |
defer memProfileFile.Close() | |
err = pprof.WriteHeapProfile(memProfileFile) | |
if err != nil { | |
log.Fatal("Could not write memory profile: ", err) | |
} | |
log.Println("Memory profile written to mem_profile.pprof") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
use the
top
command andweb
command top get details about memory usage