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

Issue 72833002: Fix DocumentTest/SkDocument memory leaks (Closed)

Created:
7 years, 1 month ago by robertphillips
Modified:
7 years, 1 month ago
Reviewers:
edisonn, scroggo, reed1
CC:
skia-team_googlegroups.com
Visibility:
Public.

Description

I'm not familiar with this code but this CL is intended to fix the following 4 memory leaks: 80 bytes in 1 blocks are definitely lost in loss record 175 of 357 at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E986E: SkDocument::CreatePDF(SkWStream*, void (*)(SkWStream*), SkData* (*)(unsigned long*, SkBitmap const&), float) (SkDocument_PDF.cpp:92) by 0x42EAA0: skiatest::document_testsClass::onRun(skiatest::Reporter*) (DocumentTest.cpp:12) by 0x49670A: skiatest::Test::run() (Test.cpp:109) by 0x48FDA0: SkTestRunnable::run() (skia_test.cpp:155) The document created by SkDocument::CreatePDF is leaked in the test_empty test. 1,844 (96 direct, 1,748 indirect) bytes in 1 blocks are definitely lost in loss record 312 of 357 at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E98A2: SkDocument::CreatePDF(SkWStream*, void (*)(SkWStream*), SkData* (*)(unsigned long*, SkBitmap const&), float) (SkDocument_PDF.cpp:20) by 0x42EB1F: skiatest::document_testsClass::onRun(skiatest::Reporter*) (DocumentTest.cpp:21) by 0x49670A: skiatest::Test::run() (Test.cpp:109) by 0x48FDA0: SkTestRunnable::run() (skia_test.cpp:155) The SkPDFDocument allocated in SkDocument_PDF's ctor is leaked when the test is aborted in test_abort. 16 bytes in 1 blocks are definitely lost in loss record 55 of 357 at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E994D: SkDocument::CreatePDF(char const*, SkData* (*)(unsigned long*, SkBitmap const&), float) (SkDocument_PDF.cpp:102) by 0x42EC7A: skiatest::document_testsClass::onRun(skiatest::Reporter*) (DocumentTest.cpp:45) by 0x49670A: skiatest::Test::run() (Test.cpp:109) by 0x48FDA0: SkTestRunnable::run() (skia_test.cpp:155) The stream allocated in SkDocument::CreatePDF is leaked when the test is aborted in test_abortWithFile. 2,728 (96 direct, 2,632 indirect) bytes in 1 blocks are definitely lost in loss record 318 of 357 at 0x4C2B1C7: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) by 0x4E99BF: SkDocument::CreatePDF(char const*, SkData* (*)(unsigned long*, SkBitmap const&), float) (SkDocument_PDF.cpp:20) by 0x42EC7A: skiatest::document_testsClass::onRun(skiatest::Reporter*) (DocumentTest.cpp:45) by 0x49670A: skiatest::Test::run() (Test.cpp:109) by 0x48FDA0: SkTestRunnable::run() (skia_test.cpp:155) The SkPDFDocument allocated in SkDocument_PDF's ctor is leaked when the test is aborted in test_abortWithFile.

Patch Set 1 #

Patch Set 2 : Added aborted parameter #

Patch Set 3 : Added comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+20 lines, -9 lines) Patch
M include/core/SkDocument.h View 1 2 4 chunks +6 lines, -3 lines 0 comments Download
M src/doc/SkDocument.cpp View 1 3 chunks +10 lines, -2 lines 0 comments Download
M src/doc/SkDocument_PDF.cpp View 1 2 chunks +3 lines, -3 lines 0 comments Download
M tests/DocumentTest.cpp View 1 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
robertphillips
7 years, 1 month ago (2013-11-14 16:23:42 UTC) #1
edisonn
LGTM I am not sure if we should have an fAbortProc, or if fDoneProc should ...
7 years, 1 month ago (2013-11-14 16:37:25 UTC) #2
reed1
On 2013/11/14 16:37:25, edisonn wrote: > LGTM > > I am not sure if we ...
7 years, 1 month ago (2013-11-14 18:28:20 UTC) #3
robertphillips
7 years, 1 month ago (2013-11-18 16:27:02 UTC) #4
Message was sent while issue was closed.
committed as r12302

Powered by Google App Engine
This is Rietveld 408576698