[PATCH] D67293: [scudo][standalone] Android related improvements

Kostya Kortchinsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 6 10:57:23 PDT 2019


cryptoad created this revision.
cryptoad added reviewers: hctim, morehouse, vitalybuka, eugenis, cferris.
Herald added subscribers: Sanitizers, delcypher, srhines.
Herald added a reviewer: rengolin.
Herald added projects: LLVM, Sanitizers.

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.


Repository:
  rCRT Compiler Runtime

https://reviews.llvm.org/D67293

Files:
  lib/scudo/standalone/allocator_config.h
  lib/scudo/standalone/combined.h
  lib/scudo/standalone/size_class_map.h
  lib/scudo/standalone/tests/combined_test.cpp
  lib/scudo/standalone/tests/wrappers_c_test.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67293.219141.patch
Type: text/x-patch
Size: 5347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190906/1fb96615/attachment.bin>


More information about the llvm-commits mailing list