Skip to content

Commit

Permalink
Suggestion: Print Allocation in red
Browse files Browse the repository at this point in the history
This makes it a bit easier to identify individual allocation instances when a vector of them is printed in the REPL
  • Loading branch information
baggepinnen authored and topolarity committed Nov 6, 2023
1 parent 6dddb84 commit aa2be6e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/AllocCheck.jl
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,12 @@ function Base.show(io::IO, alloc::AllocInstance)
typ = guess_julia_type(alloc.inst)

if length(alloc.backtrace) == 0
Base.println(io, "Allocation of ", typ, " in ")
Base.printstyled(io, "Allocation", color=:red, bold=true)
Base.println(io, " of ", typ, " in ")
Base.println(io, alloc.inst)
else
Base.println(io, "Allocation of ", typ, " in ", alloc.backtrace[1].file, ":", alloc.backtrace[1].line)
Base.printstyled(io, "Allocation", color=:red, bold=true)
Base.println(io, " of ", typ, " in ", alloc.backtrace[1].file, ":", alloc.backtrace[1].line)

# Print code excerpt of allocation site
try
Expand Down

0 comments on commit aa2be6e

Please sign in to comment.