diff options
author | 2021-02-16 14:06:31 +0000 | |
---|---|---|
committer | 2021-02-23 15:24:27 +0000 | |
commit | 1214319d27e7fb4c4ff00b39799df6f15288098a (patch) | |
tree | 8708943822a634322bd9790c4d008210e44b3ddb /runtime/class_linker_test.cc | |
parent | b7cb691fb8da124e8a6276a5a7fee47dd0aaa338 (diff) |
Lazily allocate DexCache arrays.
We rarely need the DexCache for compiled code.
Delay the allocation in hope we never need it.
This reduces DexCache memory usage by ~25% at startup.
Test: m test-art-host-gtest
Test: test.py -r -b --host
Change-Id: I680a59c905c2b821ee954e4b32abd5d24876bd11
Diffstat (limited to 'runtime/class_linker_test.cc')
-rw-r--r-- | runtime/class_linker_test.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc index c561c4d591..53908d8c0b 100644 --- a/runtime/class_linker_test.cc +++ b/runtime/class_linker_test.cc @@ -1544,8 +1544,9 @@ TEST_F(ClassLinkerTest, RegisterDexFileName) { nullptr, nullptr)); // Make a copy of the dex cache with changed name. - LinearAlloc* alloc = Runtime::Current()->GetLinearAlloc(); - dex_cache.Assign(class_linker->AllocAndInitializeDexCache(Thread::Current(), *dex_file, alloc)); + dex_cache.Assign(class_linker->AllocAndInitializeDexCache(Thread::Current(), + *dex_file, + /* class_loader= */ nullptr)); DCHECK_EQ(dex_cache->GetLocation()->CompareTo(location.Get()), 0); { WriterMutexLock mu(soa.Self(), *Locks::dex_lock_); |