android_system_core/libziparchive
Zimuzo 5a503efaf0 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
2018-09-19 19:20:21 +01:00
..
include/ziparchive zip_archive: Allow crc_out to be nullptr in Inflate. 2017-10-30 18:26:41 +00:00
testdata Check filename memory bound when parsing ziparchive 2017-06-30 17:19:28 +09:00
.clang-format add a performance benchmark for libziparchive 2017-05-30 10:50:14 -07:00
Android.bp Make unzip available. 2018-09-04 13:33:30 -07:00
entry_name_utils-inl.h Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
entry_name_utils_test.cc Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
OWNERS Add OWNERS. 2017-12-07 13:30:03 -08:00
unzip.cpp Add libziparchive-based unzip. 2017-06-04 11:53:48 -07:00
zip_archive.cc Reduce libziparchive internal hashtable memory size 2018-09-19 19:20:21 +01:00
zip_archive_benchmark.cpp BENCHMARK_MAIN now requires a semicolon. 2017-12-13 18:19:18 -08:00
zip_archive_common.h Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
zip_archive_private.h Reduce libziparchive internal hashtable memory size 2018-09-19 19:20:21 +01:00
zip_archive_stream_entry.cc libziparchive: Use ReadAtOffset exclusively 2017-07-25 18:12:12 +00:00
zip_archive_test.cc Merge "Make ziparchive-tests run standalone." am: c8a8771b6b 2018-04-25 14:57:29 -07:00
zip_writer.cc Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00
zip_writer_test.cc Ran clang-format on libziparchive sources and headers 2017-07-02 11:46:53 +09:00