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

Issue 2158023002: Pdfium: Fix fonts leaking on ClosePage. (Closed)

Created:
4 years, 5 months ago by snake
Modified:
4 years, 3 months ago
CC:
pdfium-reviews_googlegroups.com
Base URL:
https://pdfium.googlesource.com/pdfium@master
Target Ref:
refs/heads/master
Project:
pdfium
Visibility:
Public.

Description

Fix memory leaking on ClosePage. CFX_FontCache refactoring: after this CL: Only one global CFX_FontCache used. Any cached items from it, are released, when its are not used. BUG=79367, 48791 The fonts was not cleared after unloading pages. Test pdf: http://www.nasa.gov/pdf/750614main_NASA_FY_2014_Budget_Estimates-508.pdf For this file, we have ~5 fonts per page, which equal ~1 Mb per page. In this PDF we have 670 pages, as result after slow scrolling(reading) full document we have ~600 Mb fonts data in memory. memory usage of PDF Plugin: before this CL: ~660 Mb after this CL: ~100 Mb Committed: https://pdfium.googlesource.com/pdfium/+/cde5101eb15b24519e89fa500fe37038bc8e2201

Patch Set 1 #

Patch Set 2 : Fix leaks on ClosePage. #

Patch Set 3 : Fix crash. #

Total comments: 2

Patch Set 4 : #

Patch Set 5 : Fix leaks on PageClose #

Total comments: 14

Patch Set 6 : Fix leaks on PageClose. #

Patch Set 7 : Fix review issues #

Patch Set 8 : Fix leaks on ClosePage #

Patch Set 9 : Fix mac compilation. #

Patch Set 10 : Fix xfa tests. #

Total comments: 8
Unified diffs Side-by-side diffs Delta from patch set Stats (+222 lines, -270 lines) Patch
M core/fpdfapi/fpdf_page/fpdf_page_doc.cpp View 1 2 3 7 chunks +14 lines, -7 lines 2 comments Download
M core/fpdfapi/fpdf_parser/cpdf_document.cpp View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M core/fpdfapi/fpdf_render/fpdf_render.cpp View 1 2 3 4 2 chunks +1 line, -11 lines 0 comments Download
M core/fpdfapi/fpdf_render/fpdf_render_text.cpp View 1 2 3 4 5 6 9 chunks +8 lines, -30 lines 0 comments Download
M core/fpdfapi/fpdf_render/render_int.h View 1 2 3 4 3 chunks +0 lines, -3 lines 0 comments Download
M core/fxge/agg/fx_agg_driver.h View 1 2 3 4 2 chunks +0 lines, -2 lines 0 comments Download
M core/fxge/agg/fx_agg_driver.cpp View 1 2 3 4 2 chunks +0 lines, -2 lines 0 comments Download
M core/fxge/apple/apple_int.h View 1 2 3 4 3 chunks +0 lines, -4 lines 0 comments Download
M core/fxge/apple/fx_apple_platform.cpp View 1 2 3 4 5 6 7 8 5 chunks +3 lines, -6 lines 0 comments Download
M core/fxge/apple/fx_quartz_device.cpp View 1 2 3 4 6 chunks +5 lines, -8 lines 0 comments Download
M core/fxge/ge/cfx_facecache.cpp View 1 2 3 4 5 6 5 chunks +6 lines, -6 lines 0 comments Download
M core/fxge/ge/cfx_font.cpp View 1 2 3 4 5 6 7 8 9 9 chunks +57 lines, -7 lines 2 comments Download
M core/fxge/ge/cfx_fontcache.cpp View 1 2 3 4 5 6 7 2 chunks +19 lines, -34 lines 2 comments Download
M core/fxge/ge/cfx_renderdevice.cpp View 1 2 3 4 5 6 10 chunks +12 lines, -25 lines 0 comments Download
M core/fxge/ifx_renderdevicedriver.cpp View 1 2 3 4 2 chunks +0 lines, -3 lines 0 comments Download
M core/fxge/include/cfx_facecache.h View 1 2 3 4 5 6 1 chunk +6 lines, -6 lines 0 comments Download
M core/fxge/include/cfx_fontcache.h View 1 2 3 4 5 6 7 2 chunks +12 lines, -5 lines 2 comments Download
M core/fxge/include/cfx_renderdevice.h View 1 2 3 4 3 chunks +0 lines, -3 lines 0 comments Download
M core/fxge/include/fx_font.h View 1 2 3 4 5 6 7 8 9 5 chunks +25 lines, -10 lines 0 comments Download
M core/fxge/include/ifx_renderdevicedriver.h View 1 2 3 4 2 chunks +0 lines, -2 lines 0 comments Download
M core/fxge/skia/fx_skia_device.h View 1 2 3 4 2 chunks +0 lines, -2 lines 0 comments Download
M core/fxge/skia/fx_skia_device.cpp View 1 2 3 4 5 6 8 chunks +8 lines, -19 lines 0 comments Download
M core/fxge/skia/fx_skia_device_unittest.cpp View 1 2 3 4 4 chunks +4 lines, -6 lines 0 comments Download
M core/fxge/win32/fx_win32_print.cpp View 1 2 3 4 5 2 chunks +0 lines, -2 lines 0 comments Download
M core/fxge/win32/win32_int.h View 1 2 3 4 2 chunks +0 lines, -2 lines 0 comments Download
M xfa/fde/fde_gedevice.cpp View 1 2 3 4 4 chunks +9 lines, -11 lines 0 comments Download
M xfa/fxbarcode/oned/BC_OneDimWriter.cpp View 1 2 3 4 2 chunks +4 lines, -5 lines 0 comments Download
M xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp View 1 2 3 4 6 chunks +9 lines, -15 lines 0 comments Download
M xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp View 1 2 3 4 4 chunks +6 lines, -10 lines 0 comments Download
M xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp View 1 2 3 4 8 chunks +12 lines, -20 lines 0 comments Download
M xfa/fxgraphics/cfx_graphics.cpp View 1 2 3 4 1 chunk +2 lines, -3 lines 0 comments Download

Messages

Total messages: 100 (54 generated)
snake
4 years, 5 months ago (2016-07-18 17:24:11 UTC) #4
jam
redirecting to tsepez
4 years, 5 months ago (2016-07-18 17:49:09 UTC) #6
Tom Sepez
Passing the buck.
4 years, 5 months ago (2016-07-18 17:51:16 UTC) #9
dsinclair
Can you update the description with the memory usage after this CL is applied? For ...
4 years, 5 months ago (2016-07-18 17:56:13 UTC) #10
snake
On 2016/07/18 17:56:13, dsinclair wrote: > Can you update the description with the memory usage ...
4 years, 5 months ago (2016-07-18 18:05:03 UTC) #11
brucedawson
I verified the huge increase in memory when scrolling this PDF and verified the memory ...
4 years, 5 months ago (2016-07-18 18:08:47 UTC) #13
dsinclair
On 2016/07/18 18:05:03, snake wrote: > On 2016/07/18 17:56:13, dsinclair wrote: > > Can you ...
4 years, 5 months ago (2016-07-18 18:23:14 UTC) #14
snake
On 2016/07/18 18:05:03, snake wrote: > On 2016/07/18 17:56:13, dsinclair wrote: > > Can you ...
4 years, 5 months ago (2016-07-18 18:25:59 UTC) #15
snake
On 2016/07/18 18:23:14, dsinclair wrote: > On 2016/07/18 18:05:03, snake wrote: > > On 2016/07/18 ...
4 years, 5 months ago (2016-07-18 18:29:51 UTC) #16
dsinclair
lgtm
4 years, 5 months ago (2016-07-18 19:08:03 UTC) #19
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2158023002/20001
4 years, 5 months ago (2016-07-18 19:08:12 UTC) #20
commit-bot: I haz the power
Try jobs failed on following builders: linux_xfa on master.tryserver.client.pdfium (JOB_FAILED, https://build.chromium.org/p/tryserver.client.pdfium/builders/linux_xfa/builds/1369)
4 years, 5 months ago (2016-07-18 19:14:22 UTC) #22
snake
On 2016/07/18 19:14:22, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 5 months ago (2016-07-18 19:29:24 UTC) #23
dsinclair
https://codereview.chromium.org/2158023002/diff/40001/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp File core/fpdfapi/fpdf_page/fpdf_page_doc.cpp (right): https://codereview.chromium.org/2158023002/diff/40001/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp#newcode456 core/fpdfapi/fpdf_page/fpdf_page_doc.cpp:456: if (it_copied_stream != m_IccProfileMap.end()) Should we be removing the ...
4 years, 5 months ago (2016-07-18 20:13:48 UTC) #24
snake
https://codereview.chromium.org/2158023002/diff/40001/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp File core/fpdfapi/fpdf_page/fpdf_page_doc.cpp (right): https://codereview.chromium.org/2158023002/diff/40001/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp#newcode456 core/fpdfapi/fpdf_page/fpdf_page_doc.cpp:456: if (it_copied_stream != m_IccProfileMap.end()) On 2016/07/18 20:13:48, dsinclair wrote: ...
4 years, 5 months ago (2016-07-19 18:55:14 UTC) #25
dsinclair
lgtm
4 years, 5 months ago (2016-07-19 18:56:39 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2158023002/40001
4 years, 5 months ago (2016-07-19 18:56:50 UTC) #28
commit-bot: I haz the power
Try jobs failed on following builders: mac_no_v8 on master.tryserver.client.pdfium (JOB_FAILED, https://build.chromium.org/p/tryserver.client.pdfium/builders/mac_no_v8/builds/1383) win_xfa on master.tryserver.client.pdfium (JOB_FAILED, ...
4 years, 5 months ago (2016-07-19 19:03:03 UTC) #30
dsinclair
Is this still valid?
4 years, 4 months ago (2016-08-17 18:33:11 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2158023002/60001
4 years, 3 months ago (2016-09-07 17:39:57 UTC) #36
commit-bot: I haz the power
Try jobs failed on following builders: linux_xfa on master.tryserver.client.pdfium (JOB_FAILED, https://build.chromium.org/p/tryserver.client.pdfium/builders/linux_xfa/builds/1976)
4 years, 3 months ago (2016-09-07 18:39:47 UTC) #38
snake
On 2016/09/07 18:39:47, commit-bot: I haz the power wrote: > Try jobs failed on following ...
4 years, 3 months ago (2016-09-09 16:28:17 UTC) #39
brucedawson
On 2016/09/09 16:28:17, snake wrote: > On 2016/09/07 18:39:47, commit-bot: I haz the power wrote: ...
4 years, 3 months ago (2016-09-09 18:40:57 UTC) #44
snake
On 2016/09/09 18:40:57, brucedawson wrote: > On 2016/09/09 16:28:17, snake wrote: > > On 2016/09/07 ...
4 years, 3 months ago (2016-09-13 15:29:48 UTC) #45
dsinclair
4 years, 3 months ago (2016-09-13 15:47:45 UTC) #47
npm_g
On 2016/09/13 15:29:48, snake wrote: > On 2016/09/09 18:40:57, brucedawson wrote: > > On 2016/09/09 ...
4 years, 3 months ago (2016-09-13 17:21:14 UTC) #48
snake
On 2016/09/13 17:21:14, npm_g wrote: > On 2016/09/13 15:29:48, snake wrote: > > On 2016/09/09 ...
4 years, 3 months ago (2016-09-13 17:44:40 UTC) #49
dsinclair
On 2016/09/13 17:44:40, snake wrote: > But after loading the last page, all other pages ...
4 years, 3 months ago (2016-09-13 17:57:48 UTC) #51
snake
On 2016/09/13 17:57:48, dsinclair wrote: > On 2016/09/13 17:44:40, snake wrote: > > But after ...
4 years, 3 months ago (2016-09-13 18:27:11 UTC) #52
npm
On 2016/09/13 18:27:11, snake wrote: > On 2016/09/13 17:57:48, dsinclair wrote: > > On 2016/09/13 ...
4 years, 3 months ago (2016-09-13 21:50:14 UTC) #53
snake
On 2016/09/13 21:50:14, npm wrote: > On 2016/09/13 18:27:11, snake wrote: > > On 2016/09/13 ...
4 years, 3 months ago (2016-09-14 10:37:36 UTC) #54
dsinclair
On 2016/09/14 10:37:36, snake wrote: > The current CFX_FontCache and CPDF_DocPageData implementation works like this: ...
4 years, 3 months ago (2016-09-14 12:46:21 UTC) #55
snake
On 2016/09/14 12:46:21, dsinclair wrote: > On 2016/09/14 10:37:36, snake wrote: > > The current ...
4 years, 3 months ago (2016-09-14 17:08:22 UTC) #56
snake
> Are both caches needed? Can we rework the code to remove one of them? ...
4 years, 3 months ago (2016-09-14 17:23:50 UTC) #60
dsinclair
I'm still a bit confused about the purpose of the two levels of caching. Is ...
4 years, 3 months ago (2016-09-14 17:51:51 UTC) #69
npm
On 2016/09/14 17:51:51, dsinclair wrote: > I'm still a bit confused about the purpose of ...
4 years, 3 months ago (2016-09-14 19:04:14 UTC) #72
snake
https://codereview.chromium.org/2158023002/diff/80001/core/fxge/ge/cfx_font.cpp File core/fxge/ge/cfx_font.cpp (right): https://codereview.chromium.org/2158023002/diff/80001/core/fxge/ge/cfx_font.cpp#newcode269 core/fxge/ge/cfx_font.cpp:269: m_FaceCache = pFont->GetFaceCache(); On 2016/09/14 17:51:50, dsinclair wrote: > ...
4 years, 3 months ago (2016-09-14 19:06:30 UTC) #73
snake
> I'm still a bit confused about the purpose of the two levels of caching. ...
4 years, 3 months ago (2016-09-14 19:10:01 UTC) #74
snake
On 2016/09/14 19:04:14, npm wrote: > On 2016/09/14 17:51:51, dsinclair wrote: > > I'm still ...
4 years, 3 months ago (2016-09-14 19:12:56 UTC) #75
npm
Your suggested change now uses the cfx_fontcache from the ge module. This is a global ...
4 years, 3 months ago (2016-09-14 23:07:59 UTC) #90
snake
https://codereview.chromium.org/2158023002/diff/180001/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp File core/fpdfapi/fpdf_page/fpdf_page_doc.cpp (right): https://codereview.chromium.org/2158023002/diff/180001/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp#newcode462 core/fpdfapi/fpdf_page/fpdf_page_doc.cpp:462: return it_copied_stream->second->AddRef(); On 2016/09/14 23:07:59, npm wrote: > If ...
4 years, 3 months ago (2016-09-15 10:39:26 UTC) #91
npm
lgtm Could you update the description to comment on the changes regarding CFX_FontCache? Also, include ...
4 years, 3 months ago (2016-09-15 14:27:53 UTC) #92
snake
On 2016/09/15 14:27:53, npm wrote: > lgtm > > Could you update the description to ...
4 years, 3 months ago (2016-09-15 20:58:26 UTC) #94
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2158023002/180001
4 years, 3 months ago (2016-09-15 20:59:26 UTC) #97
commit-bot: I haz the power
Committed patchset #10 (id:180001) as https://pdfium.googlesource.com/pdfium/+/cde5101eb15b24519e89fa500fe37038bc8e2201
4 years, 3 months ago (2016-09-15 21:11:14 UTC) #99
dsinclair
4 years, 3 months ago (2016-09-19 15:17:44 UTC) #100
Message was sent while issue was closed.
A revert of this CL (patchset #10 id:180001) has been created in
https://codereview.chromium.org/2350763002/ by dsinclair@chromium.org.

The reason for reverting is: Causes heap-use-after-free. See crbug.com/647612..

Powered by Google App Engine
This is Rietveld 408576698