Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1827)

Issue 5824049: Fix four memory leaks uncovered by valgrinding gm tests. (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
12 years, 3 months ago by Steve VanDeBogart
Modified:
12 years, 3 months ago
Reviewers:
TomH, reed1
CC:
skia-review_googlegroups.com
Base URL:
https://skia.googlecode.com/svn/trunk
Visibility:
Public.

Description

Fix four memory leaks uncovered by valgrinding gm tests. All are triggered by PDF code. Two are missing unref's on SkData. One is a missing unref on a SkAdvancedTypefaceMetrics. The last is missing destruction of SkClipStack internal state. BUG=526 Committed: https://code.google.com/p/skia/source/detail?r=3386

Patch Set 1 #

Total comments: 2

Patch Set 2 : Address comments #

Unified diffs Side-by-side diffs Delta from patch set Stats (+15 lines, -8 lines) Patch
M include/core/SkClipStack.h View 1 chunk +1 line, -1 line 0 comments Download
M src/core/SkClipStack.cpp View 1 2 chunks +11 lines, -3 lines 0 comments Download
M src/pdf/SkPDFFont.cpp View 2 chunks +2 lines, -3 lines 0 comments Download
M src/pdf/SkPDFStream.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 4
Steve VanDeBogart
12 years, 3 months ago (2012-03-14 17:38:04 UTC) #1
reed1
One suggestion for reset(), but otherwise lgtm. Nice catch on the clipstack leak (doh!) https://codereview.appspot.com/5824049/diff/1/src/core/SkClipStack.cpp ...
12 years, 3 months ago (2012-03-14 17:54:08 UTC) #2
TomH
Ditto what Mike said. LGTM Thanks!
12 years, 3 months ago (2012-03-14 17:57:13 UTC) #3
Steve VanDeBogart
12 years, 3 months ago (2012-03-14 18:30:12 UTC) #4
https://codereview.appspot.com/5824049/diff/1/src/core/SkClipStack.cpp
File src/core/SkClipStack.cpp (left):

https://codereview.appspot.com/5824049/diff/1/src/core/SkClipStack.cpp#oldcod...
src/core/SkClipStack.cpp:121: void SkClipStack::reset() {
On 2012/03/14 17:54:08, reed1 wrote:
> Can this also be written as:
> 
> 
>     while (!fDeque.empty()) {
>         Rec* rec = (Rec*)fDeque.back();
>         rec->~Rec();
>         fDeque.pop_back();
>     }
> 
> That would seem to closer match the pattern used in ::restore(). Not sure if
its
> faster or not, but it seems lighter-weight than using an Iter.

Done.

This also let me remove the next bit of code, because fDeque is now empty.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b