diff options
author | Mike Ma <yanmin@google.com> | 2020-03-20 16:30:37 -0700 |
---|---|---|
committer | Mike Ma <yanmin@google.com> | 2020-03-23 18:46:58 -0700 |
commit | 892ccd9bd5184cb71123040ac84f1bdec21cecaa (patch) | |
tree | 533c26bbe7e5a4b926959cca597337463f2e77bc /tools/aapt2/java/JavaClassGenerator_test.cpp | |
parent | a8dfb52c0f4253eccd0fbabf6e144002345bc26c (diff) |
Optimize memory usage in incidentd
EncodedBuffer is used a lot in incidentd. EncodedBuffer uses malloc
internally to acquire memory. Frequently creating and destroying
EncodedBuffer creates memory fragmentation, leading to high memory
usage after taking an incident report.
Also fixes a few other places with lots of malloc/free operations.
This change:
* Creates a pool of EncodedBuffer in incidentd. The saving is
significant. It reduces EncodedBuffer creation from 3 per section to
3 per report.
* Replaces malloc with mmap inside EncodedBuffer. mmap is guaranteed
to be mem page aligned, so there will be no mem fragmentation after
destroying EncodedBuffer.
* Replaces new with mmap inside TombstoneSection
* Forks a process to execute LogSection, because liblog malloc & free
significant amount of memory
Result:
PSS before taking a report: 1295 KB
PSS after taking a report: 1336 KB
Bug: 150311553
Test: heapprofd
Change-Id: I83bd9c969b751c80b2f42747020799bd85d8aae6
Diffstat (limited to 'tools/aapt2/java/JavaClassGenerator_test.cpp')
0 files changed, 0 insertions, 0 deletions