reduce record time allocator's initial block size

The record time allocator's initial block size is 12,800
(100 * sizeof GrPipline) bytes.
This means that the fibonacci progression grows rapidly to large
block sizes. This is causing out of memory errors in Chrome and
Android as they try to allocate very large blocks.

Reduce the initial allocation to 1024 bytes to reduce growth
rate.
F   *1,024    *12,800
=====================
0    1,024     12,800
1    1,024     12,800
2    2,048     25,600
3    3,072     38,400
4    5,120     64,000
5    8,192    102,400
6   13,312    166,400
7   21,504    268,800
8   34,816    435,200
9   56,320    704,000
10  91,136  1,139,200
11 147,456  1,843,200

Bug: b/182959903
Bug: chromium:1188071

Change-Id: I5ef1c736efb42b2bccd78549d129154c0857bbca
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/385938
Commit-Queue: Herb Derby <herb@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Herb Derby 2021-03-17 15:10:32 -04:00 committed by Skia Commit-Bot
parent 30fce9c2ab
commit 662622e5e6

View File

@ -119,7 +119,7 @@ GrRecordingContext::OwnedArenas& GrRecordingContext::OwnedArenas::operator=(Owne
GrRecordingContext::Arenas GrRecordingContext::OwnedArenas::get() {
if (!fRecordTimeAllocator) {
// TODO: empirically determine a better number for SkArenaAlloc's firstHeapAllocation param
fRecordTimeAllocator = std::make_unique<SkArenaAlloc>(sizeof(GrPipeline) * 100);
fRecordTimeAllocator = std::make_unique<SkArenaAlloc>(1024);
}
if (!fRecordTimeSubRunAllocator) {