diff options
author | 2016-11-29 06:50:35 -0800 | |
---|---|---|
committer | 2016-11-29 06:50:35 -0800 | |
commit | e4cd00699167cefde9abedbd49ede64f82d552c7 (patch) | |
tree | 4921bc19c367263ce66532675cb846ee3bc383ee /src/sksl/SkSLToken.h | |
parent | c51c18fd783737391e26541cbb5a72af2396ef7b (diff) |
Make GrMemoryPool play nice with bucketing allocators.
Some memory allocators have very coarse size buckets, so for example on
Android (jemalloc) an attempt to allocate 32 KiB + 1 byte will end up
allocating 40 KiB, wasting 8 KiB.
GrMemoryPool ctor takes two arguments that specify prealloc / block sizes,
and then inflates them to accommodate some bookkeeping structures. Since
most places create GrMemoryPools with pow2 numbers (which have buckets in
most allocators) the inflation causes allocator to select next size bucket,
wasting memory.
This CL makes GrMemoryPool to stop inflating sizes it was created with, and
allocate specified amounts exactly. Part of allocated memory is then used for
bookkeeping structures. Additionally, GrObjectMemoryPool template is provided,
which takes prealloc / block object counts (instead of sizes) and guarantees
that specified number of objects will fit in prealloc / block spaces.
BUG=651872
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2525773002
Review-Url: https://codereview.chromium.org/2525773002
Diffstat (limited to 'src/sksl/SkSLToken.h')
0 files changed, 0 insertions, 0 deletions