summaryrefslogtreecommitdiff
path: root/runtime/class_linker.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r--runtime/class_linker.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index 0c8d53927e..2d19bfc207 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -2538,7 +2538,9 @@ ObjPtr<mirror::DexCache> ClassLinker::AllocDexCache(/*out*/ ObjPtr<mirror::Strin
self->AssertPendingOOMException();
return nullptr;
}
- ObjPtr<mirror::String> location = intern_table_->InternStrong(dex_file.GetLocation().c_str());
+ // Use InternWeak() so that the location String can be collected when the ClassLoader
+ // with this DexCache is collected.
+ ObjPtr<mirror::String> location = intern_table_->InternWeak(dex_file.GetLocation().c_str());
if (location == nullptr) {
self->AssertPendingOOMException();
return nullptr;