Skip to content

Commit 08a53ff

Browse files
tidy up streamed files when not requesting streaming mode
1 parent c428107 commit 08a53ff

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

stdlib/Profile/src/Profile.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1286,6 +1286,7 @@ function take_heap_snapshot(filepath::AbstractString, all_one::Bool=false; strea
12861286
prefix = filepath
12871287
_stream_heap_snapshot(prefix, all_one)
12881288
Profile.HeapSnapshot.assemble_snapshot(prefix, filepath)
1289+
Profile.HeapSnapshot.cleanup_streamed_files(prefix)
12891290
end
12901291
return filepath
12911292
end

stdlib/Profile/src/heapsnapshot_reassemble.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,19 @@ function assemble_snapshot(in_prefix, io::IO)
204204
return nothing
205205
end
206206

207+
"""
208+
cleanup_streamed_files(prefix::AbstractString)
209+
210+
Remove files streamed during `take_heap_snapshot` in streaming mode.
211+
"""
212+
function cleanup_streamed_files(prefix::AbstractString)
213+
rm(string(prefix, ".metadata.json"))
214+
rm(string(prefix, ".nodes"))
215+
rm(string(prefix, ".edges"))
216+
rm(string(prefix, ".strings"))
217+
return nothing
218+
end
219+
207220
function print_str_escape_json(stream::IO, s::AbstractString)
208221
print(stream, '"')
209222
for c in s

0 commit comments

Comments
 (0)