diff options
author | Andreas Gampe <agampe@google.com> | 2015-02-23 16:33:22 -0800 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-02-24 21:57:08 -0800 |
commit | 324b9bb2f48be39e20077c1d7da45cf3dc47fe06 (patch) | |
tree | d7efdc9aade5c693ace5dfbf9871ea6dfa7625d9 /runtime/class_linker.cc | |
parent | 9e80e7fa5ef60f02f35823bc58969c3d5a03453e (diff) | |
download | android_art-324b9bb2f48be39e20077c1d7da45cf3dc47fe06.tar.gz android_art-324b9bb2f48be39e20077c1d7da45cf3dc47fe06.tar.bz2 android_art-324b9bb2f48be39e20077c1d7da45cf3dc47fe06.zip |
ART: Move DexFile vector to Java array
To avoid having native vectors only referenced by Java objects,
which look like leaks to Valgrind, use a Java array to store
references to native DexFile objects.
Change-Id: If3c2b31b9d0914ed1965cfd5e3fdb94ea41b1477
Diffstat (limited to 'runtime/class_linker.cc')
-rw-r--r-- | runtime/class_linker.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc index 327875195d..3f37fa09cc 100644 --- a/runtime/class_linker.cc +++ b/runtime/class_linker.cc @@ -2135,15 +2135,16 @@ mirror::Class* ClassLinker::FindClassInPathClassLoader(ScopedObjectAccessAlready } mirror::Object* dex_file = dex_file_field->GetObject(element); if (dex_file != nullptr) { - const uint64_t cookie = cookie_field->GetLong(dex_file); - auto* dex_files = - reinterpret_cast<std::vector<const DexFile*>*>(static_cast<uintptr_t>(cookie)); - if (dex_files == nullptr) { + mirror::LongArray* long_array = cookie_field->GetObject(dex_file)->AsLongArray(); + if (long_array == nullptr) { // This should never happen so log a warning. LOG(WARNING) << "Null DexFile::mCookie for " << descriptor; break; } - for (const DexFile* cp_dex_file : *dex_files) { + int32_t long_array_size = long_array->GetLength(); + for (int32_t j = 0; j < long_array_size; ++j) { + const DexFile* cp_dex_file = reinterpret_cast<const DexFile*>(static_cast<uintptr_t>( + long_array->GetWithoutChecks(j))); const DexFile::ClassDef* dex_class_def = cp_dex_file->FindClassDef(descriptor, hash); if (dex_class_def != nullptr) { RegisterDexFile(*cp_dex_file); |