diff options
author | Florin Malita <fmalita@chromium.org> | 2018-04-18 16:57:32 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-18 21:46:33 +0000 |
commit | c274f8f942bf756fc78ab01992aecb855231f9e3 (patch) | |
tree | 7c56c9c543eee5511c11f3bf51e52efcb9738b6f /bench | |
parent | 4c32956b1fee237ef4527dca27dd044430652ad5 (diff) |
Prevent unnecessary/unbounded growth of SkTDynamicHash capacity
SkTDynamicHash doesn't immediately recycle slots for removed entries,
but instead just marks them as deleted.
The only way to reclaim deleted slots currently is when an exponential
grow/resize is triggered.
A consequence of this is that the capacity/allocated storage can grow
indefinitely when the hash is long-lived and churning -- even if the
number of active entries is small/stable.
To prevent this, I propose we only grow the capacity when the number of
active slots constitutes a significant portion. Otherwise (when most
slots are deleted), we trigger a "purge" (resize to the same capacity)
to clear the tombstones.
Bug: chromium:832482
Change-Id: Iefdcd7439f7d62ac021e176b71007d207c8bc876
Reviewed-on: https://skia-review.googlesource.com/122082
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'bench')
0 files changed, 0 insertions, 0 deletions