summaryrefslogtreecommitdiff
path: root/libutils/FileMap.cpp
diff options
context:
space:
mode:
authorZimuzo <zezeozue@google.com>2018-09-17 19:49:55 +0100
committerZimuzo <zezeozue@google.com>2018-09-19 19:20:21 +0100
commit5a503efaf03227a99f54f50657c922c9e8a6af5e (patch)
tree8eee58a1202a6f3e9eb90788322deb3e40522d2e /libutils/FileMap.cpp
parent16fef65f9ed6e2f895a299ed347be27a0df58c56 (diff)
Reduce libziparchive internal hashtable memory size
Debugging memory allocations on the nexus launcher unveiled significant memory allocations for the hashatable used in libziparchive, ~1MB. This is partly because of the ZipString struct storing an entry in the table. The struct stored a pointer to a string (on 64 bit, 8 bytes) and the length to read from that pointer, 2 bytes. Because of alignment, the structure consumed 16 bytes, wasting 6 bytes. Now, we store entries in the hashtable as a ZipStringOffset. This new structure stores a 4 byte offset from a fixed location in the memory mapped file instead of the entire address, consuming 8 bytes with alignment. Bug: 79416399 Test: Builds successfully and manual testing by opening launcher on Pixel 2 shows precisely 50% decrease in memory allocated for the hashtable. From 909312 bytes to 454656. Change-Id: I28b43699233fbee7f63fccae2d4fe96fcc07e5c4
Diffstat (limited to 'libutils/FileMap.cpp')
0 files changed, 0 insertions, 0 deletions