diff options
-rw-r--r-- | Android.mk | 2 | ||||
-rw-r--r-- | src/common_test.h | 11 | ||||
-rw-r--r-- | src/dex_file_test.cc | 18 | ||||
-rw-r--r-- | src/heap.cc | 12 | ||||
-rw-r--r-- | src/runtime.cc | 2 |
5 files changed, 22 insertions, 23 deletions
diff --git a/Android.mk b/Android.mk index 7ddaa37cbe..7e5555da01 100644 --- a/Android.mk +++ b/Android.mk @@ -73,7 +73,7 @@ test-art-host: $(ART_HOST_TEST_DEPENDENCIES) $(ART_HOST_TEST_TARGETS) # "mm valgrind-art-host" to build and run all host tests under valgrind. .PHONY: valgrind-art-host valgrind-art-host: $(ART_HOST_TEST_DEPENDENCIES) - $(call run-host-tests-with,"valgrind") + $(call run-host-tests-with,valgrind --leak-check=full) @echo valgrind-art-host PASSED # "mm tsan-art-host" to build and run all host tests under tsan. diff --git a/src/common_test.h b/src/common_test.h index 402766f0b0..a7daba129c 100644 --- a/src/common_test.h +++ b/src/common_test.h @@ -33,13 +33,13 @@ static inline const DexFile* OpenDexFileBase64(const char* base64, // decode base64 CHECK(base64 != NULL); size_t length; - byte* dex_bytes = DecodeBase64(base64, &length); - CHECK(dex_bytes != NULL); + UniquePtr<byte[]> dex_bytes(DecodeBase64(base64, &length)); + CHECK(dex_bytes.get() != NULL); // write to provided file UniquePtr<File> file(OS::OpenFile(location.c_str(), true)); CHECK(file.get() != NULL); - if (!file->WriteFully(dex_bytes, length)) { + if (!file->WriteFully(dex_bytes.get(), length)) { PLOG(FATAL) << "Failed to write base64 as dex file"; } file.reset(); @@ -295,6 +295,7 @@ class CommonTest : public testing::Test { (*icu_cleanup_fn)(); compiler_.reset(); + STLDeleteElements(&opened_dex_files_); Heap::VerifyHeap(); // Check for heap corruption after the test } @@ -325,13 +326,13 @@ class CommonTest : public testing::Test { filename += ".jar"; const DexFile* dex_file = DexFile::Open(filename, ""); CHECK(dex_file != NULL) << "Failed to open " << filename; + opened_dex_files_.push_back(dex_file); return dex_file; } ClassLoader* LoadDex(const char* dex_name) { const DexFile* dex_file = OpenTestDexFile(dex_name); CHECK(dex_file != NULL); - loaded_dex_files_.push_back(dex_file); class_linker_->RegisterDexFile(*dex_file); std::vector<const DexFile*> class_path; class_path.push_back(dex_file); @@ -398,7 +399,7 @@ class CommonTest : public testing::Test { UniquePtr<Compiler> compiler_; private: - std::vector<const DexFile*> loaded_dex_files_; + std::vector<const DexFile*> opened_dex_files_; }; } // namespace art diff --git a/src/dex_file_test.cc b/src/dex_file_test.cc index 4b311dcc80..3cbef1593d 100644 --- a/src/dex_file_test.cc +++ b/src/dex_file_test.cc @@ -10,8 +10,8 @@ namespace art { class DexFileTest : public CommonTest {}; TEST_F(DexFileTest, Open) { - UniquePtr<const DexFile> dex(OpenTestDexFile("Nested")); - ASSERT_TRUE(dex.get() != NULL); + const DexFile* dex(OpenTestDexFile("Nested")); + ASSERT_TRUE(dex != NULL); } // Although this is the same content logically as the Nested test dex, @@ -70,8 +70,8 @@ TEST_F(DexFileTest, Header) { } TEST_F(DexFileTest, ClassDefs) { - UniquePtr<const DexFile> raw(OpenTestDexFile("Nested")); - ASSERT_TRUE(raw.get() != NULL); + const DexFile* raw(OpenTestDexFile("Nested")); + ASSERT_TRUE(raw != NULL); EXPECT_EQ(2U, raw->NumClassDefs()); const DexFile::ClassDef& c0 = raw->GetClassDef(0); @@ -82,8 +82,8 @@ TEST_F(DexFileTest, ClassDefs) { } TEST_F(DexFileTest, CreateMethodSignature) { - UniquePtr<const DexFile> raw(OpenTestDexFile("CreateMethodSignature")); - ASSERT_TRUE(raw.get() != NULL); + const DexFile* raw(OpenTestDexFile("CreateMethodSignature")); + ASSERT_TRUE(raw != NULL); EXPECT_EQ(1U, raw->NumClassDefs()); const DexFile::ClassDef& class_def = raw->GetClassDef(0); @@ -91,7 +91,7 @@ TEST_F(DexFileTest, CreateMethodSignature) { const byte* class_data = raw->GetClassData(class_def); ASSERT_TRUE(class_data != NULL); - ClassDataItemIterator it(*raw.get(), class_data); + ClassDataItemIterator it(*raw, class_data); EXPECT_EQ(1u, it.NumDirectMethods()); @@ -137,8 +137,8 @@ TEST_F(DexFileTest, CreateMethodSignature) { } TEST_F(DexFileTest, FindStringId) { - UniquePtr<const DexFile> raw(OpenTestDexFile("CreateMethodSignature")); - ASSERT_TRUE(raw.get() != NULL); + const DexFile* raw(OpenTestDexFile("CreateMethodSignature")); + ASSERT_TRUE(raw != NULL); EXPECT_EQ(1U, raw->NumClassDefs()); const char* strings[] = { "LCreateMethodSignature;", "Ljava/lang/Float;", "Ljava/lang/Object;", diff --git a/src/heap.cc b/src/heap.cc index 1efc956452..ba52a54ad4 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -151,14 +151,10 @@ void Heap::Destroy() { // all daemon threads are suspended, and we also know that the threads list have been deleted, so // those threads can't resume. We're the only running thread, and we can do whatever we like... STLDeleteElements(&spaces_); - if (mark_bitmap_ != NULL) { - delete mark_bitmap_; - mark_bitmap_ = NULL; - } - if (live_bitmap_ != NULL) { - delete live_bitmap_; - } - live_bitmap_ = NULL; + delete mark_bitmap_; + delete live_bitmap_; + delete card_table_; + delete lock_; } Object* Heap::AllocObject(Class* klass, size_t byte_count) { diff --git a/src/runtime.cc b/src/runtime.cc index c6081ff152..904d95914e 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -12,6 +12,7 @@ #include "class_linker.h" #include "class_loader.h" #include "debugger.h" +#include "dex_verifier.h" #include "heap.h" #include "image.h" #include "intern_table.h" @@ -73,6 +74,7 @@ Runtime::~Runtime() { delete class_linker_; Heap::Destroy(); + verifier::DexVerifier::DeleteGcMaps(); delete intern_table_; delete java_vm_; Thread::Shutdown(); |