Skip to content

Commit

Permalink
fix nim-lang#13794 HashSet leak
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Mar 29, 2020
1 parent 8c719fc commit 04bbb26
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/pure/collections/setimpl.nim
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ proc rawInsert[A](s: var HashSet[A], data: var KeyValuePairSeq[A], key: A,

proc enlarge[A](s: var HashSet[A]) =
var n: KeyValuePairSeq[A]
newSeq(n, len(s.data) * growthFactor)
newSeq(n, s.counter.rightSize)
swap(s.data, n) # n is now old seq
s.countDeleted = 0
for i in countup(0, high(n)):
if isFilledAndValid(n[i].hcode):
var j = -1 - rawGetKnownHC(s, n[i].key, n[i].hcode)
Expand Down

0 comments on commit 04bbb26

Please sign in to comment.