Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(431)

Unified Diff: third_party/tcmalloc/chromium/src/deep-heap-profile.cc

Issue 11418237: Get DMP to run without HEAP_PROFILE_MMAP=1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/deep-heap-profile.cc
diff --git a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
index 85352750cfb2f7d64e229bc7e3085f4164852106..4941f8d888ec8dfc381dd1d2bdae36c9604ce430 100644
--- a/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
+++ b/third_party/tcmalloc/chromium/src/deep-heap-profile.cc
@@ -245,18 +245,21 @@ int DeepHeapProfile::FillOrderedProfile(char raw_buffer[], int buffer_size) {
// Allocate a list for mmap'ed regions.
num_mmap_allocations_ = 0;
- heap_profile_->mmap_address_map_->Iterate(CountMMap, this);
- mmap_list_length_ = 0;
- mmap_list_ = reinterpret_cast<MMapListEntry*>(heap_profile_->alloc_(
- sizeof(MMapListEntry) * num_mmap_allocations_));
-
- // Touch all the allocated pages. Touching is required to avoid new page
- // commitment while filling the list in SnapshotProcMaps.
- for (int i = 0;
- i < num_mmap_allocations_;
- i += getpagesize() / 2 / sizeof(MMapListEntry))
- mmap_list_[i].first_address = 0;
- mmap_list_[num_mmap_allocations_ - 1].last_address = 0;
+ if (heap_profile_->mmap_address_map_) {
+ heap_profile_->mmap_address_map_->Iterate(CountMMap, this);
+
+ mmap_list_length_ = 0;
+ mmap_list_ = reinterpret_cast<MMapListEntry*>(heap_profile_->alloc_(
+ sizeof(MMapListEntry) * num_mmap_allocations_));
+
+ // Touch all the allocated pages. Touching is required to avoid new page
+ // commitment while filling the list in SnapshotProcMaps.
+ for (int i = 0;
+ i < num_mmap_allocations_;
+ i += getpagesize() / 2 / sizeof(MMapListEntry))
+ mmap_list_[i].first_address = 0;
+ mmap_list_[num_mmap_allocations_ - 1].last_address = 0;
+ }
stats_.SnapshotProcMaps(memory_residence_info_getter_, NULL, 0);
@@ -701,11 +704,13 @@ void DeepHeapProfile::GlobalStats::SnapshotAllocations(
deep_profile);
// mmap allocations.
- deep_profile->heap_profile_->mmap_address_map_->Iterate(RecordMMap,
- deep_profile);
- std::sort(deep_profile->mmap_list_,
- deep_profile->mmap_list_ + deep_profile->mmap_list_length_,
- ByFirstAddress);
+ if (deep_profile->heap_profile_->mmap_address_map_) {
+ deep_profile->heap_profile_->mmap_address_map_->Iterate(RecordMMap,
+ deep_profile);
+ std::sort(deep_profile->mmap_list_,
+ deep_profile->mmap_list_ + deep_profile->mmap_list_length_,
+ ByFirstAddress);
+ }
}
void DeepHeapProfile::GlobalStats::Unparse(TextBuffer* buffer) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698