Revert^4 "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.
Bug: b/181097963
Test: test.py -b --host
Change-Id: I1f654aeb538dfed013705a61b1955af1f6b94fe7
diff --git a/runtime/class_linker_test.cc b/runtime/class_linker_test.cc
index 035a9cb..e183146 100644
--- a/runtime/class_linker_test.cc
+++ b/runtime/class_linker_test.cc
@@ -1542,8 +1542,9 @@
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_);