Skip to content

Commit c857d4c

Browse files
committed
build out test a bit more
1 parent 8bf2aca commit c857d4c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

stdlib/AllocProfile/src/AllocProfile.jl

+5-5
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ end
4242

4343
function stop()
4444
raw_results = ccall(:jl_stop_alloc_profile, RawAllocResults, ())
45-
# decoded_results = GC.@preserve raw_results decode(raw_results)
46-
# ccall(:jl_free_alloc_profile, Cvoid, ())
47-
# return decoded_results
48-
return raw_results
45+
decoded_results = decode(raw_results)
46+
ccall(:jl_free_alloc_profile, Cvoid, ())
47+
return decoded_results
48+
# return raw_results
4949
end
5050

5151
# decoded results
@@ -65,7 +65,7 @@ const BacktraceEntry = Union{Ptr{Cvoid}, InterpreterIP}
6565
const BacktraceCache = Dict{BacktraceEntry,Vector{StackFrame}}
6666

6767
# loading anything below this seems to segfault
68-
# TODO: find out what's going on
68+
# TODO: use filter out special types before we get here
6969
TYPE_PTR_THRESHOLD = 0x0000000100000000
7070

7171
function load_type(ptr::Ptr{Type})::Type

stdlib/AllocProfile/test/runtests.jl

+5-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ using AllocProfile
1111
# test the allocations during compilation
1212
using Base64
1313

14-
raw_results = AllocProfile.stop()
15-
results = AllocProfile.decode(raw_results)
14+
results = AllocProfile.stop()
1615

1716
@test length(results.allocs) > 0
17+
first_alloc = results.allocs[1]
18+
@test first_alloc.size > 0
19+
@test length(first_alloc.stacktrace) > 0
20+
@test length(string(first_alloc.type)) > 0
1821
end

0 commit comments

Comments
 (0)