summaryrefslogtreecommitdiff
path: root/lib/scudo/standalone/size_class_map.h
diff options
context:
space:
mode:
authorKostya Kortchinsky <kostyak@google.com>2019-09-11 14:48:41 +0000
committerKostya Kortchinsky <kostyak@google.com>2019-09-11 14:48:41 +0000
commitbc5544f437b576ea40b5008e44f93a03844a9423 (patch)
tree41db93cc5390a16c5d7bfe7bf1488f691e4d227e /lib/scudo/standalone/size_class_map.h
parent460c5df7e72dc468923186dde9f8c3e45d0f54b2 (diff)
downloadcompiler-rt-bc5544f437b576ea40b5008e44f93a03844a9423.tar.gz
[scudo][standalone] Android related improvements
Summary: This changes a few things to improve memory footprint and performances on Android, and fixes a test compilation error: - add `stdlib.h` to `wrappers_c_test.cc` to address https://bugs.llvm.org/show_bug.cgi?id=42810 - change Android size class maps, based on benchmarks, to improve performances and lower the Svelte memory footprint. Also change the 32-bit region size for said configuration - change the `reallocate` logic to reallocate in place for sizes larger than the original chunk size, when they still fit in the same block. This addresses patterns from `memory_replay` dumps like the following: ``` 202: realloc 0xb48fd000 0xb4930650 12352 202: realloc 0xb48fd000 0xb48fd000 12420 202: realloc 0xb48fd000 0xb48fd000 12492 202: realloc 0xb48fd000 0xb48fd000 12564 202: realloc 0xb48fd000 0xb48fd000 12636 202: realloc 0xb48fd000 0xb48fd000 12708 202: realloc 0xb48fd000 0xb48fd000 12780 202: realloc 0xb48fd000 0xb48fd000 12852 202: realloc 0xb48fd000 0xb48fd000 12924 202: realloc 0xb48fd000 0xb48fd000 12996 202: realloc 0xb48fd000 0xb48fd000 13068 202: realloc 0xb48fd000 0xb48fd000 13140 202: realloc 0xb48fd000 0xb48fd000 13212 202: realloc 0xb48fd000 0xb48fd000 13284 202: realloc 0xb48fd000 0xb48fd000 13356 202: realloc 0xb48fd000 0xb48fd000 13428 202: realloc 0xb48fd000 0xb48fd000 13500 202: realloc 0xb48fd000 0xb48fd000 13572 202: realloc 0xb48fd000 0xb48fd000 13644 202: realloc 0xb48fd000 0xb48fd000 13716 202: realloc 0xb48fd000 0xb48fd000 13788 ... ``` In this situation we were deallocating the old chunk, and allocating a new one for every single one of those, but now we can keep the same chunk (we just updated the header), which saves some heap operations. Reviewers: hctim, morehouse, vitalybuka, eugenis, cferris, rengolin Reviewed By: morehouse Subscribers: srhines, delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D67293 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@371628 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/scudo/standalone/size_class_map.h')
-rw-r--r--lib/scudo/standalone/size_class_map.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/scudo/standalone/size_class_map.h b/lib/scudo/standalone/size_class_map.h
index fa52e6d9b..3b494afb3 100644
--- a/lib/scudo/standalone/size_class_map.h
+++ b/lib/scudo/standalone/size_class_map.h
@@ -137,11 +137,11 @@ typedef SizeClassMap<3, 5, 8, 17, 8, 10> DefaultSizeClassMap;
// TODO(kostyak): further tune class maps for Android & Fuchsia.
#if SCUDO_WORDSIZE == 64U
-typedef SizeClassMap<3, 5, 8, 15, 8, 10> SvelteSizeClassMap;
+typedef SizeClassMap<4, 4, 8, 14, 4, 10> SvelteSizeClassMap;
typedef SizeClassMap<3, 5, 8, 17, 14, 14> AndroidSizeClassMap;
#else
-typedef SizeClassMap<3, 4, 7, 15, 8, 10> SvelteSizeClassMap;
-typedef SizeClassMap<3, 4, 7, 17, 14, 14> AndroidSizeClassMap;
+typedef SizeClassMap<4, 3, 7, 14, 5, 10> SvelteSizeClassMap;
+typedef SizeClassMap<3, 5, 8, 17, 14, 14> AndroidSizeClassMap;
#endif
} // namespace scudo