summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anton Kirilov <anton.kirilov@linaro.org> 2017-01-06 13:33:42 +0000
committer Anton Kirilov <anton.kirilov@linaro.org> 2017-01-09 12:20:04 +0000
commit3a2e78ebade9f7e0444be6f6817cbf116b34e7b1 (patch)
treeda8d025ac510215e89224fed43660749665c5e3d
parent91db41f315f6c2366b7098c531224bee01170364 (diff)
Fix some issues reported by Valgrind
* Update the target suppression file. * Disable the detection of mismatched free() / delete / delete [] calls, since it results in a lot of false positives (a known Valgrind limitation associated with asymmetric inlining of operator new() and operator delete()). * Avoid a memory leak in the code generator tests, caused by the fact that the VIXL-based ARM code generator does not always use the arena allocator. * Fix an access to uninitialized memory. Test: m valgrind-test-art-target Test: valgrind --leak-check=full --show-mismatched-frees=no \ --ignore-range-below-sp=1024-1 \ --suppressions=valgrind-target-suppressions.txt \ dalvikvm ... Change-Id: I891a3247aa9828226b4e62c69d6e1c8398d757b8
-rw-r--r--build/Android.gtest.mk2
-rw-r--r--compiler/optimizing/codegen_test.cc5
-rw-r--r--runtime/oat_file.cc2
-rw-r--r--test/valgrind-target-suppressions.txt12
4 files changed, 15 insertions, 6 deletions
diff --git a/build/Android.gtest.mk b/build/Android.gtest.mk
index bd7f900965..5bdfbc74eb 100644
--- a/build/Android.gtest.mk
+++ b/build/Android.gtest.mk
@@ -332,7 +332,7 @@ valgrind-$$(gtest_rule): $(ART_VALGRIND_TARGET_DEPENDENCIES) test-art-target-syn
(adb shell "$(GCOV_ENV) LD_LIBRARY_PATH=$(4) ANDROID_ROOT=$(ART_GTEST_TARGET_ANDROID_ROOT) \
valgrind --leak-check=full --error-exitcode=1 --workaround-gcc296-bugs=yes \
--suppressions=$(ART_TARGET_TEST_DIR)/valgrind-target-suppressions.txt \
- --num-callers=50 \
+ --num-callers=50 --show-mismatched-frees=no \
$$(PRIVATE_TARGET_EXE) && touch $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID" \
&& (adb pull $(ART_TARGET_TEST_DIR)/$(TARGET_$(3)ARCH)/$$@-$$$$PPID /tmp/ \
&& $$(call ART_TEST_PASSED,$$@)) \
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index 879b4ce59e..e3f3df0ff5 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -15,6 +15,7 @@
*/
#include <functional>
+#include <memory>
#include "arch/instruction_set.h"
#include "arch/arm/instruction_set_features_arm.h"
@@ -299,8 +300,8 @@ static void RunCode(CodegenTargetConfig target_config,
bool has_result,
Expected expected) {
CompilerOptions compiler_options;
- CodeGenerator* codegen = target_config.CreateCodeGenerator(graph, compiler_options);
- RunCode(codegen, graph, hook_before_codegen, has_result, expected);
+ std::unique_ptr<CodeGenerator> codegen(target_config.CreateCodeGenerator(graph, compiler_options));
+ RunCode(codegen.get(), graph, hook_before_codegen, has_result, expected);
}
#ifdef ART_ENABLE_CODEGEN_arm
diff --git a/runtime/oat_file.cc b/runtime/oat_file.cc
index 0bf713679b..2e4211133c 100644
--- a/runtime/oat_file.cc
+++ b/runtime/oat_file.cc
@@ -710,7 +710,7 @@ bool DlOpenOatFile::Dlopen(const std::string& elf_filename,
return false;
}
#ifdef ART_TARGET_ANDROID
- android_dlextinfo extinfo;
+ android_dlextinfo extinfo = {};
extinfo.flags = ANDROID_DLEXT_FORCE_LOAD | // Force-load, don't reuse handle
// (open oat files multiple
// times).
diff --git a/test/valgrind-target-suppressions.txt b/test/valgrind-target-suppressions.txt
index fbc99b12ce..452a17412a 100644
--- a/test/valgrind-target-suppressions.txt
+++ b/test/valgrind-target-suppressions.txt
@@ -36,8 +36,7 @@
MemCpySelfAssign
Memcheck:Overlap
fun:memcpy
- fun:je_tsd_set
- fun:je_tsd_fetch
+ ...
fun:je_malloc_tsd_boot0
}
@@ -59,3 +58,12 @@
...
fun:_ZN3art7Runtime17InitNativeMethodsEv
}
+
+# art::MemMap::MapInternal() uses msync() to check for the existence of memory mappings.
+{
+ art::MemMap::MapInternal()
+ Memcheck:Param
+ msync(start)
+ fun:msync
+ fun:_ZN3art6MemMap11MapInternalEPvmiiilb
+}