Skip to content

Deque leaks memory #884

@vustef

Description

@vustef

Deque uses data::Vector{T} in DequeBlock{T}, but it only empties this vector in rear blocks, never touching this vector in the head block, instead it only invokes reset! on it. But reset! doesn't unset index on data elements that are no longer valid in this head block, causing these objects not to be garbage collected.

I verified this by taking heap snapshot after inserting and dequeuing all elements and running GC.gc(true) - the elements were still in the heap.

Not sure if other data structures have this behaviour, I only checked for Deque (and by proxy Queue)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions