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

Issue 583293002: Do not leak when iterator outlives disk cache backend. (Closed)

Created:
6 years, 3 months ago by gavinp
Modified:
6 years, 3 months ago
CC:
chromium-reviews, cbentzel+watch_chromium.org, gavinp+disk_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@cacheenums-again
Project:
chromium
Visibility:
Public.

Description

Do not leak when iterator outlives disk cache backend. The blockfile cache was previously allocating a Rankings::Iterator object in its enumeration code which was not being freed if the backend was destroyed before the iterator. This change ensures that no memory is leaked if an iterator outlives its backend. R=rvargas@chromium.org,pasko@chromium.org BUG=413644, 416059

Patch Set 1 #

Patch Set 2 : cleaner ownership #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+60 lines, -57 lines) Patch
M net/disk_cache/blockfile/backend_impl.h View 1 1 chunk +3 lines, -3 lines 0 comments Download
M net/disk_cache/blockfile/backend_impl.cc View 1 7 chunks +27 lines, -29 lines 2 comments Download
M net/disk_cache/blockfile/in_flight_backend_io.h View 1 4 chunks +7 lines, -6 lines 0 comments Download
M net/disk_cache/blockfile/in_flight_backend_io.cc View 1 4 chunks +14 lines, -12 lines 0 comments Download
M net/disk_cache/blockfile/rankings.h View 1 chunk +2 lines, -2 lines 0 comments Download
M net/disk_cache/blockfile/rankings.cc View 1 1 chunk +7 lines, -5 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
gavinp
It turns out that the blockfile cache has the same bug (or design/API issue) that ...
6 years, 3 months ago (2014-09-19 18:18:33 UTC) #1
gavinp
On 2014/09/19 18:18:33, gavinp wrote: > It turns out that the blockfile cache has the ...
6 years, 3 months ago (2014-09-19 18:18:49 UTC) #2
rvargas (doing something else)
lgtm I should have mentioned before that this backend was not freeing that memory either. ...
6 years, 3 months ago (2014-09-20 01:41:58 UTC) #3
gavinp
6 years, 3 months ago (2014-09-22 16:43:27 UTC) #4
Thanks for the review. I'm closing this issue, because I've combined this code
with https://codereview.chromium.org/583283002/ (the earlier CL), since it was
reverted because of the bug this fixes.

The combined issue is https://codereview.chromium.org/588243002/ , and I'll land
it TBR you.

https://codereview.chromium.org/583293002/diff/20001/net/disk_cache/blockfile...
File net/disk_cache/blockfile/backend_impl.cc (right):

https://codereview.chromium.org/583293002/diff/20001/net/disk_cache/blockfile...
net/disk_cache/blockfile/backend_impl.cc:1259:
background_queue_->EndEnumeration(iterator_.Pass());
On 2014/09/20 01:41:58, rvargas wrote:
> Technically, all that was needed was iterator_.release() here and the part to
> eliminate the iterator destructor.

Absolutely. The rest of the changes amount to adding type safety to moving the
void* around.

Powered by Google App Engine
This is Rietveld 408576698