diff --git a/cleanup/cleanup.go b/cleanup/cleanup.go index 8de4ff7..2c6bb6d 100644 --- a/cleanup/cleanup.go +++ b/cleanup/cleanup.go @@ -106,6 +106,17 @@ func CleanUp(fs afero.Fs, cfg Config) ([]string, error) { } deletedFiles = append(deletedFiles, path) + + // SAP JVM also creates .addons files that should be removed as well + addonPath := path[0:len(path)-len(".hprof")] + ".addons" + addonFile, err := fs.Stat(addonPath) + if !os.IsNotExist(err) && addonFile.Mode().isRegular() { + var err = fs.Remove(addonPath) + if err != nil { + return nil, fmt.Errorf("Cannot delete heap dump addon file '"+addonPath+"': %v", err) + } + deletedFiles = append(deletedFiles, addonPath) + } } return deletedFiles, nil