summaryrefslogtreecommitdiff
path: root/src/heap-checker.cc
diff options
context:
space:
mode:
authorcsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2011-03-04 23:52:33 +0000
committercsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2011-03-04 23:52:33 +0000
commit6fe07cd2c0527e18276cc79a57e2212a4b048746 (patch)
treebddf3a270eaa039d36146c6f77e76a058c09ecfb /src/heap-checker.cc
parent75584139e40c9d6c952d9c5339c52e5b58302fc8 (diff)
downloadgperftools-6fe07cd2c0527e18276cc79a57e2212a4b048746.tar.gz
* add a flag to use MAP_PRIVATE in memfs_malloc (gangren)
* pthread_self() is now safe to use early (ppluzhnikov) * windows support for pprof: nul and /usr/bin/file (csilvers) * fix tc_malloc_size for debugallocation (csilvers) * add test on strdup to tcmalloc_test (csilvers) * augment heap-checker to deal with no-inode maps (csilvers) * Get rid of -Wno-unused-result: not all gcc's support it (csilvers) * /bin/true -> ':', which is faster and more portable (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@107 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'src/heap-checker.cc')
-rw-r--r--src/heap-checker.cc32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/heap-checker.cc b/src/heap-checker.cc
index dfda9ad..1794e8b 100644
--- a/src/heap-checker.cc
+++ b/src/heap-checker.cc
@@ -882,6 +882,8 @@ HeapLeakChecker::ProcMapsResult HeapLeakChecker::UseProcMapsLocked(
int64 inode;
char *permissions, *filename;
bool saw_shared_lib = false;
+ bool saw_nonzero_inode = false;
+ bool saw_shared_lib_with_nonzero_inode = false;
while (it.Next(&start_address, &end_address, &permissions,
&file_offset, &inode, &filename)) {
if (start_address >= end_address) {
@@ -897,16 +899,22 @@ HeapLeakChecker::ProcMapsResult HeapLeakChecker::UseProcMapsLocked(
// do things in this loop.
continue;
}
- // Determine if any shared libraries are present. This is the same
- // list of extensions as is found in pprof.
- if (strstr(filename, ".dll")) { // for windows, which doesn't have inodes
+ // Determine if any shared libraries are present (this is the same
+ // list of extensions as is found in pprof). We want to ignore
+ // 'fake' libraries with inode 0 when determining. However, some
+ // systems don't share inodes via /proc, so we turn off this check
+ // if we don't see any evidence that we're getting inode info.
+ if (inode != 0) {
+ saw_nonzero_inode = true;
+ }
+ if ((strstr(filename, "lib") && strstr(filename, ".so")) ||
+ strstr(filename, ".dll") ||
+ // not all .dylib filenames start with lib. .dylib is big enough
+ // that we are unlikely to get false matches just checking that.
+ strstr(filename, ".dylib") || strstr(filename, ".bundle")) {
saw_shared_lib = true;
- } else if (inode != 0) { // ignore fake files
- if ((strstr(filename, "lib") && strstr(filename, ".so")) ||
- // not all .dylib filenames start with lib. .dylib is big enough
- // that we are unlikely to get false matches just checking that.
- strstr(filename, ".dylib") || strstr(filename, ".bundle")) {
- saw_shared_lib = true;
+ if (inode != 0) {
+ saw_shared_lib_with_nonzero_inode = true;
}
}
@@ -927,6 +935,12 @@ HeapLeakChecker::ProcMapsResult HeapLeakChecker::UseProcMapsLocked(
RAW_CHECK(0, "");
}
}
+ // If /proc/self/maps is reporting inodes properly (we saw a
+ // non-zero inode), then we only say we saw a shared lib if we saw a
+ // 'real' one, with a non-zero inode.
+ if (saw_nonzero_inode) {
+ saw_shared_lib = saw_shared_lib_with_nonzero_inode;
+ }
if (!saw_shared_lib) {
RAW_LOG(ERROR, "No shared libs detected. Will likely report false leak "
"positives for statically linked executables.");