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

Issue 774683003: Remove tcmalloc when not being used. Restore shim on Windows. (Closed)

Created:
6 years ago by Will Harris
Modified:
5 years, 11 months ago
CC:
chromium-reviews, wfh+watch_chromium.org, erikwright+watch_chromium.org, Dai Mikurube (NOT FULLTIME), scottmg
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Restore the allocator shim on Windows. Add 2Gb limit on allocations via the shim. Remove tcmalloc from Windows. Restore working tcmalloc_unittests on Linux and allocator_unittests on other platforms. Add Death tests to base_unittests SecurityTests. Fix prep_libc.py to actually strip the objects correctly. BUG=169327, 434397 TEST=base_unittests --gtest_filter=SecurityTest.* TEST=allocator_unittests, tcmalloc_unittest Committed: https://crrev.com/74a449cac1340e85b3ef06be59a91fdd29110454 Cr-Commit-Position: refs/heads/master@{#311194}

Patch Set 1 #

Patch Set 2 : change to WINLFH on all Windows platforms. Enable exceptions on OOM. #

Patch Set 3 : Remove tcmalloc from Windows build. Call new_handler on any allocation failure. Limit to 2Gb. Add … #

Total comments: 5

Patch Set 4 : some linux fixes #

Patch Set 5 : fix linux #

Patch Set 6 : fix preprocessor #

Patch Set 7 : resurrect tcmalloc_unittest on linux #

Total comments: 6

Patch Set 8 : fix allocator_unittest #

Patch Set 9 : fix circular dep. tcmalloc_unittest needs atomic ops from tcmalloc #

Patch Set 10 : fix prep_libc.py and rename allocator_shim.cc #

Total comments: 31

Patch Set 11 : fix nits. add new OOM death test. #

Total comments: 8

Patch Set 12 : add realloc death test. nits. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+627 lines, -854 lines) Patch
M base/allocator/allocator.gyp View 1 2 3 4 5 6 7 8 9 9 chunks +241 lines, -297 lines 0 comments Download
D base/allocator/allocator_shim.h View 1 2 1 chunk +0 lines, -27 lines 0 comments Download
M base/allocator/allocator_shim.cc View 1 2 3 4 5 6 7 8 9 1 chunk +0 lines, -378 lines 0 comments Download
A base/allocator/allocator_shim_win.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +221 lines, -0 lines 0 comments Download
M base/allocator/allocator_unittest.cc View 1 2 3 4 5 6 7 4 chunks +9 lines, -5 lines 0 comments Download
M base/allocator/generic_allocators.cc View 1 2 3 4 5 6 2 chunks +2 lines, -2 lines 0 comments Download
M base/allocator/prep_libc.py View 1 2 3 4 5 6 7 8 9 10 3 chunks +27 lines, -29 lines 0 comments Download
M base/allocator/tcmalloc_unittest.cc View 1 2 3 4 5 6 1 chunk +20 lines, -5 lines 0 comments Download
M base/allocator/win_allocator.cc View 1 2 3 4 5 6 7 1 chunk +0 lines, -78 lines 0 comments Download
M base/profiler/alternate_timer.cc View 1 2 3 4 5 6 7 2 chunks +1 line, -2 lines 0 comments Download
M base/security_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 10 chunks +98 lines, -17 lines 0 comments Download
M build/common.gypi View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +8 lines, -5 lines 0 comments Download
M content/browser/browser_main_runner.cc View 1 2 2 chunks +0 lines, -9 lines 0 comments Download

Messages

Total messages: 41 (6 generated)
Will Harris
We shouldn't drop the 2Gb memory limits, so adding the shim back. Need to have ...
6 years ago (2014-12-10 16:59:27 UTC) #2
cpu_(ooo_6.6-7.5)
The issue with tcmalloc is that it eat the address space which affects XP as ...
6 years ago (2014-12-11 20:20:34 UTC) #3
cpu_(ooo_6.6-7.5)
ah never mind, it is not a global limit, its a 2GB per allocation (!).
6 years ago (2014-12-11 20:21:50 UTC) #4
Will Harris
On 2014/12/11 20:21:50, cpu wrote: > ah never mind, it is not a global limit, ...
6 years ago (2014-12-11 20:24:32 UTC) #5
cpu_(ooo_6.6-7.5)
and there is one more thing this changes. As is, the heap is the process ...
6 years ago (2014-12-11 20:27:34 UTC) #6
Will Harris
On 2014/12/11 20:27:34, cpu wrote: > and there is one more thing this changes. > ...
6 years ago (2014-12-13 06:50:23 UTC) #7
jschuh
Just to clarify, to me it looks like the change here is using WINHEAP but ...
6 years ago (2014-12-15 14:36:06 UTC) #8
cpu_(ooo_6.6-7.5)
we talked about f2f. wfh will investigate if we can have our cake and eat ...
6 years ago (2014-12-15 23:17:03 UTC) #9
Will Harris
On 2014/12/15 23:17:03, cpu wrote: > we talked about f2f. wfh will investigate if we ...
6 years ago (2014-12-16 22:22:59 UTC) #10
cpu_(ooo_6.6-7.5)
alright, I won't be that guy who increases the risk of pwnage, although I think ...
6 years ago (2014-12-17 22:32:21 UTC) #11
jschuh
I am comfortable with your demands.
6 years ago (2014-12-18 17:30:03 UTC) #12
Will Harris
On 2014/12/18 17:30:03, jschuh wrote: > I am comfortable with your demands. Indeed, after a ...
6 years ago (2014-12-18 17:41:48 UTC) #13
Will Harris
WIP CL. Tcmalloc code should be now gone on Windows. Added some new death tests. ...
5 years, 11 months ago (2015-01-07 07:37:16 UTC) #15
cpu_(ooo_6.6-7.5)
https://codereview.chromium.org/774683003/diff/60001/base/allocator/win_allocator.cc File base/allocator/win_allocator.cc (right): https://codereview.chromium.org/774683003/diff/60001/base/allocator/win_allocator.cc#newcode15 base/allocator/win_allocator.cc:15: win_heap = static_cast<HANDLE>(GetProcessHeap()); use http://msdn.microsoft.com/en-us/library/csd157zx.aspx ? so you don't ...
5 years, 11 months ago (2015-01-07 17:25:26 UTC) #16
cpu_(ooo_6.6-7.5)
https://codereview.chromium.org/774683003/diff/60001/base/allocator/allocator_shim.cc File base/allocator/allocator_shim.cc (right): https://codereview.chromium.org/774683003/diff/60001/base/allocator/allocator_shim.cc#newcode19 base/allocator/allocator_shim.cc:19: static int new_mode = 0; I don't see anybody ...
5 years, 11 months ago (2015-01-07 17:28:42 UTC) #17
Will Harris
working on fixing up Linux now. Finding a lot of issues so far :( https://codereview.chromium.org/774683003/diff/60001/base/allocator/win_allocator.cc ...
5 years, 11 months ago (2015-01-07 17:29:37 UTC) #18
Will Harris
https://codereview.chromium.org/774683003/diff/60001/base/allocator/allocator_shim.cc File base/allocator/allocator_shim.cc (right): https://codereview.chromium.org/774683003/diff/60001/base/allocator/allocator_shim.cc#newcode19 base/allocator/allocator_shim.cc:19: static int new_mode = 0; On 2015/01/07 17:28:42, cpu ...
5 years, 11 months ago (2015-01-07 17:32:47 UTC) #19
cpu_(ooo_6.6-7.5)
https://codereview.chromium.org/774683003/diff/140001/base/allocator/allocator_shim.cc File base/allocator/allocator_shim.cc (right): https://codereview.chromium.org/774683003/diff/140001/base/allocator/allocator_shim.cc#newcode24 base/allocator/allocator_shim.cc:24: #include "win_allocator.cc" shouldn't we simply copy that code over ...
5 years, 11 months ago (2015-01-08 18:05:43 UTC) #20
Will Harris
now just need to fix up the GN parts. https://codereview.chromium.org/774683003/diff/140001/base/allocator/allocator_shim.cc File base/allocator/allocator_shim.cc (right): https://codereview.chromium.org/774683003/diff/140001/base/allocator/allocator_shim.cc#newcode24 base/allocator/allocator_shim.cc:24: ...
5 years, 11 months ago (2015-01-08 22:10:57 UTC) #21
cpu_(ooo_6.6-7.5)
now what is the disadvantage of using _get_heap_handle() ? the way I see it, if ...
5 years, 11 months ago (2015-01-08 22:38:45 UTC) #22
cpu_(ooo_6.6-7.5)
also note that there is no "D" on the left of /win_allocator.cc like there is ...
5 years, 11 months ago (2015-01-08 22:40:28 UTC) #23
Will Harris
5 years, 11 months ago (2015-01-09 01:14:17 UTC) #24
Will Harris
PTAL (Chrome ate my comment) As discussed we need to implement _get_heap_handle() ourselves since we ...
5 years, 11 months ago (2015-01-09 01:16:35 UTC) #25
scottmg
https://codereview.chromium.org/774683003/diff/200001/base/allocator/allocator_shim_win.cc File base/allocator/allocator_shim_win.cc (right): https://codereview.chromium.org/774683003/diff/200001/base/allocator/allocator_shim_win.cc#newcode11 base/allocator/allocator_shim_win.cc:11: //#include "base/allocator/allocator_extension_thunks.h" remove these? https://codereview.chromium.org/774683003/diff/200001/base/allocator/allocator_shim_win.cc#newcode30 base/allocator/allocator_shim_win.cc:30: std::numeric_limits<int>::max() - kWindowsPageSize; ...
5 years, 11 months ago (2015-01-09 23:32:48 UTC) #28
cpu_(ooo_6.6-7.5)
https://codereview.chromium.org/774683003/diff/200001/base/allocator/allocator_shim_win.cc File base/allocator/allocator_shim_win.cc (right): https://codereview.chromium.org/774683003/diff/200001/base/allocator/allocator_shim_win.cc#newcode11 base/allocator/allocator_shim_win.cc:11: //#include "base/allocator/allocator_extension_thunks.h" remove commented includes. https://codereview.chromium.org/774683003/diff/200001/base/allocator/allocator_shim_win.cc#newcode13 base/allocator/allocator_shim_win.cc:13: //#include "base/profiler/alternate_timer.h" ...
5 years, 11 months ago (2015-01-09 23:46:56 UTC) #29
Will Harris
PTAL. Also, added a new test to exhaust memory and check for death. https://codereview.chromium.org/774683003/diff/200001/base/allocator/allocator_shim_win.cc File ...
5 years, 11 months ago (2015-01-11 06:30:40 UTC) #30
scottmg
lgtm https://codereview.chromium.org/774683003/diff/240001/base/allocator/allocator_shim_win.cc File base/allocator/allocator_shim_win.cc (right): https://codereview.chromium.org/774683003/diff/240001/base/allocator/allocator_shim_win.cc#newcode117 base/allocator/allocator_shim_win.cc:117: #else Could probably just remove the _HAS_EXCEPTIONS arm, ...
5 years, 11 months ago (2015-01-12 16:51:02 UTC) #31
Will Harris
scottmg@ comments addressed PTAL https://codereview.chromium.org/774683003/diff/240001/base/allocator/allocator_shim_win.cc File base/allocator/allocator_shim_win.cc (right): https://codereview.chromium.org/774683003/diff/240001/base/allocator/allocator_shim_win.cc#newcode117 base/allocator/allocator_shim_win.cc:117: #else On 2015/01/12 16:51:01, scottmg ...
5 years, 11 months ago (2015-01-12 19:03:44 UTC) #32
cpu_(ooo_6.6-7.5)
lgtm
5 years, 11 months ago (2015-01-12 22:37:03 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/774683003/260001
5 years, 11 months ago (2015-01-13 01:06:04 UTC) #35
commit-bot: I haz the power
Committed patchset #12 (id:260001)
5 years, 11 months ago (2015-01-13 03:12:25 UTC) #36
commit-bot: I haz the power
Patchset 12 (id:??) landed as https://crrev.com/74a449cac1340e85b3ef06be59a91fdd29110454 Cr-Commit-Position: refs/heads/master@{#311194}
5 years, 11 months ago (2015-01-13 03:13:06 UTC) #37
Nico
Where was this restored from? clang warns: In file included from ..\..\base\allocator\allocator_shim_win.cc:219: ..\..\base\allocator/generic_allocators.cc(31,6) : warning(clang): ...
5 years, 11 months ago (2015-01-14 03:36:40 UTC) #39
Will Harris
On 2015/01/14 03:36:40, Nico wrote: > Where was this restored from? clang warns: > > ...
5 years, 11 months ago (2015-01-14 17:14:09 UTC) #40
Nico
5 years, 11 months ago (2015-01-16 22:03:11 UTC) #41
Message was sent while issue was closed.
On Wed, Jan 14, 2015 at 9:14 AM, <wfh@chromium.org> wrote:

> On 2015/01/14 03:36:40, Nico wrote:
>
>> Where was this restored from? clang warns:
>>
>
>  In file included from ..\..\base\allocator\allocator_shim_win.cc:219:
>> ..\..\base\allocator/generic_allocators.cc(31,6) :  warning(clang):
>> function
>> previously declared with an explicit exception specification redeclared
>> with
>>
> an
>
>> implicit exception specification [-Wimplicit-exception-spec-mismatch]
>> void operator delete(void* p) {
>>       ^
>> ..\..\base\allocator/generic_allocators.cc(39,6) :  warning(clang):
>> function
>> previously declared with an explicit exception specification redeclared
>> with
>>
> an
>
>> implicit exception specification [-Wimplicit-exception-spec-mismatch]
>> void operator delete[](void* p) {
>>       ^
>> ..\..\base\allocator/generic_allocators.cc(47,6) :  warning(clang):
>> function
>> previously declared with an explicit exception specification redeclared
>> with
>>
> an
>
>> implicit exception specification [-Wimplicit-exception-spec-mismatch]
>> void operator delete(void* p, const std::nothrow_t& nt) {
>>       ^
>>
>
> C:\b\depot_tools\win_toolchain\vs2013_files\win8sdk\bin\..\..\VC\include\
> new.h(96,16)
>
>> :  note(clang): previous declaration is here
>> void __CRTDECL operator delete(void *, const std::nothrow_t&) throw();
>>                 ^
>> In file included from ..\..\base\allocator\allocator_shim_win.cc:219:
>> ..\..\base\allocator/generic_allocators.cc(55,6) :  warning(clang):
>> function
>> previously declared with an explicit exception specification redeclared
>> with
>>
> an
>
>> implicit exception specification [-Wimplicit-exception-spec-mismatch]
>> void operator delete[](void* p, const std::nothrow_t& nt) {
>>       ^
>>
>
> C:\b\depot_tools\win_toolchain\vs2013_files\win8sdk\bin\..\..\VC\include\
> new.h(97,16)
>
>> :  note(clang): previous declaration is here
>> void __CRTDECL operator delete[](void *, const std::nothrow_t&) throw();
>>                 ^
>>
>
>
>  I have vivid memories of fixing this exact thing before in Aug 2014, here:
>> https://codereview.chromium.org/419323002/
>> https://codereview.chromium.org/447513002/
>>
>
> generic_allocators.cc was already there, but it's included into
> allocator_shim_win.cc which now includes new.h, so it's possible we're now
> re-declaring these functions without the throw().
>
> This code wasn't being compiled until this CL, because cpu@ removed the
> shim
> back in r305567.  I imagine re-adding the throw() will fix this.  I can
> take a
> look when I'm back in the office,


Thanks, looking forward to it :-)


> unless it's urgent then you're welcome to add
> the throw().
>
> https://codereview.chromium.org/774683003/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698