Skip to content

Commit

Permalink
dbg: env var for heap profile output file path (#12453)
Browse files Browse the repository at this point in the history
Cherry pick #12398 into `release/2.61`

Co-authored-by: milen <[email protected]>
  • Loading branch information
yperbasis and taratorio authored Oct 24, 2024
1 parent c5b89b4 commit 9020781
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion erigon-lib/common/dbg/experiments.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ var (
// force skipping of any non-Erigon2 .torrent files
DownloaderOnlyBlocks = EnvBool("DOWNLOADER_ONLY_BLOCKS", false)
saveHeapProfile = EnvBool("SAVE_HEAP_PROFILE", false)
heapProfileFilePath = EnvString("HEAP_PROFILE_FILE_PATH", "")
)

var StagesOnlyBlocks = EnvBool("STAGES_ONLY_BLOCKS", false)
Expand Down Expand Up @@ -381,7 +382,12 @@ func SaveHeapProfileNearOOM(opts ...SaveHeapOption) {
}

// above 45%
filePath := filepath.Join(os.TempDir(), "erigon-mem.prof")
var filePath string
if heapProfileFilePath == "" {
filePath = filepath.Join(os.TempDir(), "erigon-mem.prof")
} else {
filePath = heapProfileFilePath
}
if logger != nil {
logger.Info("[Experiment] saving heap profile as near OOM", "filePath", filePath)
}
Expand Down

0 comments on commit 9020781

Please sign in to comment.