Skip to content

Commit

Permalink
Test Deque for leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
kpamnany committed Feb 20, 2024
1 parent 156460a commit 04ad0a7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test_deque.jl
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,27 @@
@test last(q) == 3
@test num_blocks(q) == 1
end

@testset "pop! and popfirst! don't leak" begin
q = Deque{Int}(4)

@testset "pop! doesn't leak" begin
push!(q,2)
pushfirst!(q,1)
ss2 = Base.summarysize(q)
pop!(q)
GC.gc(true)
ss1 = Base.summarysize(q)
@test ss1 < ss2
end
@testset "popfirst! doesn't leak" begin
push!(q,2)
push!(q,3)
ss2 = Base.summarysize(q)
popfirst!(q)
GC.gc(true)
ss1 = Base.summarysize(q)
@test ss1 < ss2
end
end
end # @testset Deque

0 comments on commit 04ad0a7

Please sign in to comment.