Skip to content

Commit

Permalink
dbg: env var for heap profile output file path (#12398)
Browse files Browse the repository at this point in the history
relates to
#11387 (comment)
port of #12400 to E2
  • Loading branch information
taratorio authored and yperbasis committed Oct 24, 2024
1 parent c5b89b4 commit eb08ed4
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 eb08ed4

Please sign in to comment.