Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(147)

Issue 1514893003: Create a hash table from id<-->key in SkImageFilter::CacheImpl (Closed)

Created:
5 years ago by xidachen
Modified:
5 years ago
CC:
reviews_skia.org
Base URL:
https://chromium.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Create a hash table from id<-->key in SkImageFilter::CacheImpl There is memory leak in the SkImageFilter::Cache. There are two sources of memory leak: 1. The cache filling up quickly. 2. A slow small leak that never stops. This CL solves the first issue, which prevents the cache filling up quickly. This CL creates a new hash table that index the SkImageFilter::uniqueID to an array of keys, and with the existing key<-->Value hash table, we can have SkImageFilters proactively purge content derived cached content when destroyed. BUG=489543 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1514893003 Committed: https://skia.googlesource.com/skia/+/f5d1f8dcc841516d7ea63c151b13059af40ca76d Committed: https://skia.googlesource.com/skia/+/627769144d233b3abce5ee86cf315df61fa8dcd7

Patch Set 1 #

Patch Set 2 : working code #

Total comments: 11

Patch Set 3 : switch to SkTHashMap #

Total comments: 12

Patch Set 4 : better var names #

Total comments: 8

Patch Set 5 : Remove KeyArray #

Total comments: 6

Patch Set 6 : fix minor issues #

Patch Set 7 : remove const in purgeByImageFilterId argument list #

Total comments: 2

Patch Set 8 : clean up in ~CacheImpl #

Unified diffs Side-by-side diffs Delta from patch set Stats (+30 lines, -5 lines) Patch
M include/core/SkImageFilter.h View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/core/SkImageFilter.cpp View 1 2 3 4 5 6 7 6 chunks +29 lines, -5 lines 0 comments Download

Messages

Total messages: 43 (14 generated)
xidachen
PTAL, needs some help please. https://codereview.chromium.org/1514893003/diff/20001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/1514893003/diff/20001/src/core/SkImageFilter.cpp#newcode624 src/core/SkImageFilter.cpp:624: fIDLookup.add(arr); mtklein@: this patch ...
5 years ago (2015-12-11 12:04:22 UTC) #3
Justin Novosad
https://codereview.chromium.org/1514893003/diff/20001/include/core/SkImageFilter.h File include/core/SkImageFilter.h (right): https://codereview.chromium.org/1514893003/diff/20001/include/core/SkImageFilter.h#newcode46 include/core/SkImageFilter.h:46: virtual void destroyKeysFromUniqueID(uint32_t) {} The important thing that this ...
5 years ago (2015-12-11 13:53:31 UTC) #4
mtklein
I'm not quite sure I see yet how this could fix a memory leak. Isn't ...
5 years ago (2015-12-11 14:02:50 UTC) #5
xidachen
On 2015/12/11 14:02:50, mtklein wrote: > I'm not quite sure I see yet how this ...
5 years ago (2015-12-11 14:14:38 UTC) #6
Justin Novosad
On 2015/12/11 14:02:50, mtklein wrote: > I'm not quite sure I see yet how this ...
5 years ago (2015-12-11 14:18:26 UTC) #7
mtklein
On 2015/12/11 at 14:18:26, junov wrote: > On 2015/12/11 14:02:50, mtklein wrote: > > I'm ...
5 years ago (2015-12-11 14:47:06 UTC) #8
xidachen
Hi Mike, As you pointed out in the original bug: Back in May (#4-#12) we ...
5 years ago (2015-12-11 15:29:44 UTC) #9
mtklein
On 2015/12/11 at 15:29:44, xidachen wrote: > Hi Mike, > > As you pointed out ...
5 years ago (2015-12-11 15:52:06 UTC) #10
xidachen
Hi Mike, I have switched to SkTHashMap, and it works fine. I have tested the ...
5 years ago (2015-12-11 16:08:04 UTC) #12
Justin Novosad
The hardest two things in computer programming: Cache invalidations, naming things, and off by one ...
5 years ago (2015-12-11 16:41:51 UTC) #13
xidachen
https://codereview.chromium.org/1514893003/diff/40001/include/core/SkImageFilter.h File include/core/SkImageFilter.h (right): https://codereview.chromium.org/1514893003/diff/40001/include/core/SkImageFilter.h#newcode46 include/core/SkImageFilter.h:46: virtual void destroyKeysFromUniqueID(uint32_t) {} On 2015/12/11 16:41:51, Justin Novosad ...
5 years ago (2015-12-11 18:13:45 UTC) #14
xidachen
mtklein@: gentle ping, could you take a look. Thank you.
5 years ago (2015-12-15 17:45:32 UTC) #15
mtklein
Let's add a note something like this to the CL description: "Have SkImageFilters proactively purge ...
5 years ago (2015-12-15 20:32:16 UTC) #16
xidachen
https://codereview.chromium.org/1514893003/diff/60001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/1514893003/diff/60001/src/core/SkImageFilter.cpp#newcode135 src/core/SkImageFilter.cpp:135: uint32_t fImageFilterUniqueID; On 2015/12/15 20:32:15, mtklein wrote: > It ...
5 years ago (2015-12-16 13:38:04 UTC) #19
mtklein
lgtm, with some small suggestions https://codereview.chromium.org/1514893003/diff/80001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/1514893003/diff/80001/src/core/SkImageFilter.cpp#newcode205 src/core/SkImageFilter.cpp:205: Cache::Get()->purgeByImageFilterId(fUniqueID); I was thinking ...
5 years ago (2015-12-16 13:54:33 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1514893003/100001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1514893003/100001
5 years ago (2015-12-16 14:15:04 UTC) #23
commit-bot: I haz the power
Try jobs failed on following builders: skia_presubmit-Trybot on client.skia.fyi (JOB_FAILED, http://build.chromium.org/p/client.skia.fyi/builders/skia_presubmit-Trybot/builds/4739)
5 years ago (2015-12-16 14:16:08 UTC) #25
xidachen
reed1@: since this CL changes the SkImageFilter API, it needs your approval. PTAL. https://codereview.chromium.org/1514893003/diff/80001/src/core/SkImageFilter.cpp File ...
5 years ago (2015-12-16 16:02:42 UTC) #26
xidachen
reed1@: gentle ping, could you take a look? This CL changes an API which requires ...
5 years ago (2015-12-17 20:47:43 UTC) #27
reed1
lgtm
5 years ago (2015-12-17 20:49:26 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1514893003/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1514893003/120001
5 years ago (2015-12-17 21:01:28 UTC) #31
commit-bot: I haz the power
Committed patchset #7 (id:120001) as https://skia.googlesource.com/skia/+/f5d1f8dcc841516d7ea63c151b13059af40ca76d
5 years ago (2015-12-17 22:12:27 UTC) #33
Stephen White
On 2015/12/15 20:32:16, mtklein wrote: > Let's add a note something like this to the ...
5 years ago (2015-12-17 22:23:14 UTC) #34
reed1
A revert of this CL (patchset #7 id:120001) has been created in https://codereview.chromium.org/1537923002/ by reed@google.com. ...
5 years ago (2015-12-18 13:22:56 UTC) #35
mtklein
https://codereview.chromium.org/1514893003/diff/120001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/1514893003/diff/120001/src/core/SkImageFilter.cpp#newcode570 src/core/SkImageFilter.cpp:570: } I think we missed cleanup, something like this: ...
5 years ago (2015-12-18 14:43:22 UTC) #36
xidachen
https://codereview.chromium.org/1514893003/diff/120001/src/core/SkImageFilter.cpp File src/core/SkImageFilter.cpp (right): https://codereview.chromium.org/1514893003/diff/120001/src/core/SkImageFilter.cpp#newcode570 src/core/SkImageFilter.cpp:570: } On 2015/12/18 14:43:22, mtklein wrote: > I think ...
5 years ago (2015-12-21 14:42:39 UTC) #37
mtklein
lgtm
5 years ago (2015-12-21 15:14:03 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1514893003/140001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1514893003/140001
5 years ago (2015-12-21 15:14:07 UTC) #41
commit-bot: I haz the power
5 years ago (2015-12-21 15:29:11 UTC) #43
Message was sent while issue was closed.
Committed patchset #8 (id:140001) as
https://skia.googlesource.com/skia/+/627769144d233b3abce5ee86cf315df61fa8dcd7

Powered by Google App Engine
This is Rietveld 408576698