llvm-project/compiler-rt/lib/scudo/standalone
Kostya Kortchinsky 161cca266a [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

llvm-svn: 371628
2019-09-11 14:48:41 +00:00
..
tests [scudo][standalone] Android related improvements 2019-09-11 14:48:41 +00:00
CMakeLists.txt compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
allocator_config.h [scudo][standalone] Android related improvements 2019-09-11 14:48:41 +00:00
atomic_helpers.h [scudo][standalone] Merge Spin & Blocking mutex into a Hybrid one 2019-07-11 15:32:26 +00:00
bytemap.h [scudo][standalone] Merge Spin & Blocking mutex into a Hybrid one 2019-07-11 15:32:26 +00:00
checksum.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
checksum.h [scudo][standalone] Introduce the chunk header 2019-05-08 21:54:02 +00:00
chunk.h compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
combined.h [scudo][standalone] Android related improvements 2019-09-11 14:48:41 +00:00
common.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
common.h [scudo][standalone] Merge Spin & Blocking mutex into a Hybrid one 2019-07-11 15:32:26 +00:00
crc32_hw.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
flags.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
flags.h [scudo][standalone] Add flags & related parsers 2019-04-09 14:57:25 +00:00
flags.inc [scudo][standalone] Add flags & related parsers 2019-04-09 14:57:25 +00:00
flags_parser.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
flags_parser.h [scudo][standalone] Introduce the C & C++ wrappers [fixed] 2019-06-27 14:23:26 +00:00
fuchsia.cpp [scudo][standalone] Minor corrections 2019-08-12 15:35:09 +00:00
fuchsia.h [scudo][standalone] Introduce the Secondary allocator 2019-04-24 14:20:49 +00:00
interface.h [scudo][standalone] Add flags & related parsers 2019-04-09 14:57:25 +00:00
internal_defs.h [scudo][standalone] Minor corrections 2019-08-12 15:35:09 +00:00
linux.cpp [scudo][standalone] Minor corrections 2019-08-12 15:35:09 +00:00
linux.h [scudo][standalone] Introduce the Secondary allocator 2019-04-24 14:20:49 +00:00
list.h [scudo][standalone] Minor corrections 2019-08-12 15:35:09 +00:00
local_cache.h [scudo][standalone] Add more stats to mallinfo 2019-08-14 16:04:01 +00:00
mutex.h [scudo][standalone] Add more stats to mallinfo 2019-08-14 16:04:01 +00:00
platform.h
primary32.h [scudo][standalone] Add more stats to mallinfo 2019-08-14 16:04:01 +00:00
primary64.h [scudo][standalone] Fix malloc_iterate 2019-08-20 16:17:08 +00:00
quarantine.h [scudo][standalone] Minor corrections 2019-08-12 15:35:09 +00:00
release.h [scudo][standalone] Add the memory reclaiming mechanism 2019-04-30 14:56:18 +00:00
report.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
report.h [scudo][standalone] Add error reports 2019-03-20 14:31:23 +00:00
secondary.cpp [scudo][standalone] Minor corrections 2019-08-12 15:35:09 +00:00
secondary.h [scudo][standalone] Optimization pass 2019-07-24 16:36:01 +00:00
size_class_map.h [scudo][standalone] Android related improvements 2019-09-11 14:48:41 +00:00
stats.h [scudo][standalone] Add more stats to mallinfo 2019-08-14 16:04:01 +00:00
string_utils.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
string_utils.h [scudo][standalone] Add string utility functions 2019-03-19 14:47:05 +00:00
tsd.h [scudo][standalone] Merge Spin & Blocking mutex into a Hybrid one 2019-07-11 15:32:26 +00:00
tsd_exclusive.h [scudo][standalone] Optimization pass 2019-07-24 16:36:01 +00:00
tsd_shared.h [scudo][standalone] Optimization pass 2019-07-24 16:36:01 +00:00
vector.h [scudo][standalone] Add a standalone vector class 2019-02-27 16:30:05 +00:00
wrappers_c.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
wrappers_c.h [scudo][standalone] Introduce the C & C++ wrappers [fixed] 2019-06-27 14:23:26 +00:00
wrappers_c.inc [scudo][standalone] Add more stats to mallinfo 2019-08-14 16:04:01 +00:00
wrappers_c_bionic.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00
wrappers_c_checks.h [scudo][standalone] Introduce the C & C++ wrappers [fixed] 2019-06-27 14:23:26 +00:00
wrappers_cpp.cpp compiler-rt: Rename .cc file in lib/scudo/standalone to .cpp 2019-08-01 14:36:38 +00:00