Details
Assignee
UnassignedUnassignedReporter
Alexander YakushevAlexander YakushevLabels
Approval
TriagedPriority
MinorAffects versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Alexander Yakushev
Alexander YakushevLabels
Approval
Triaged
Priority
Affects versions
Created August 30, 2018 at 11:24 AM
Updated August 30, 2018 at 3:53 PM
References to elements
pop
'ed from PersistentQueue are not immediately removed from the queue. This may lead to situations where the queue holds onto many more objects than it currently contains.This happens because the PersistentQueue is implemented using two PersistentVectors, one for head, and one for tail. Once the head is empty, the tail vector is transformed into ChunkedSeq (by calling seq on it) and put into the head. However, ChunkedSeq always retains the reference to the whole starting vector, even as it is shrinked with
next
.Example, with clj-memory-meter:
Perhaps, if this behavior is expected, it can be at least reflected in the docs somewhere? Given that PQ is already hidden and underdocumented.