Skip to content

Commit

Permalink
build out test a bit more
Browse files Browse the repository at this point in the history
  • Loading branch information
vilterp committed Dec 14, 2021
1 parent 2835c3a commit f8a7720
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
10 changes: 5 additions & 5 deletions stdlib/AllocProfile/src/AllocProfile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ end

function stop()
raw_results = ccall(:jl_stop_alloc_profile, RawAllocResults, ())
# decoded_results = GC.@preserve raw_results decode(raw_results)
# ccall(:jl_free_alloc_profile, Cvoid, ())
# return decoded_results
return raw_results
decoded_results = decode(raw_results)
ccall(:jl_free_alloc_profile, Cvoid, ())
return decoded_results
# return raw_results
end

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

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

function load_type(ptr::Ptr{Type})::Type
Expand Down
7 changes: 5 additions & 2 deletions stdlib/AllocProfile/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ using AllocProfile
# test the allocations during compilation
using Base64

raw_results = AllocProfile.stop()
results = AllocProfile.decode(raw_results)
results = AllocProfile.stop()

@test length(results.allocs) > 0
first_alloc = results.allocs[1]
@test first_alloc.size > 0
@test length(first_alloc.stacktrace) > 0
@test length(string(first_alloc.type)) > 0
end

0 comments on commit f8a7720

Please sign in to comment.