diff options
author | Timothee Cour <timothee.cour2@gmail.com> | 2020-03-29 09:08:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-29 18:08:50 +0200 |
commit | 06f8c5cb6f04319fd6ca6eafc496f3da882ab341 (patch) | |
tree | f672112975afa4d26e1d47909338dea6229a20b4 | |
parent | 8c719fce54544c8d14ce7c0e4639c974c1748668 (diff) | |
download | Nim-06f8c5cb6f04319fd6ca6eafc496f3da882ab341.tar.gz |
fix #13794 HashSet leak (#13800)
-rw-r--r-- | lib/pure/collections/setimpl.nim | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/pure/collections/setimpl.nim b/lib/pure/collections/setimpl.nim index f7a48ab91..9e68cb072 100644 --- a/lib/pure/collections/setimpl.nim +++ b/lib/pure/collections/setimpl.nim @@ -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) |