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

Unified Diff: third_party/tcmalloc/chromium/src/heap-profile-table.h

Issue 8635003: Fix HEAP_PROFILE_MMAP in google-perftools. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Updated. Created 8 years, 11 months 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 | third_party/tcmalloc/chromium/src/heap-profile-table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/heap-profile-table.h
diff --git a/third_party/tcmalloc/chromium/src/heap-profile-table.h b/third_party/tcmalloc/chromium/src/heap-profile-table.h
index c9bee151e96291fe5db447ac84bd8f874f5890d4..6d60ae98c08c369cd1ac77466bdd70b16acee225 100644
--- a/third_party/tcmalloc/chromium/src/heap-profile-table.h
+++ b/third_party/tcmalloc/chromium/src/heap-profile-table.h
@@ -133,7 +133,8 @@ class HeapProfileTable {
// are skipped in heap checking reports.
void MarkAsIgnored(const void* ptr);
- // Return current total (de)allocation statistics.
+ // Return current total (de)allocation statistics. It doesn't contain
+ // mmap'ed regions.
const Stats& total() const { return total_; }
// Allocation data iteration callback: gets passed object pointer and
@@ -143,7 +144,7 @@ class HeapProfileTable {
// Iterate over the allocation profile data calling "callback"
// for every allocation.
void IterateAllocs(AllocIterator callback) const {
- allocation_->Iterate(MapArgsAllocIterator, callback);
+ alloc_address_map_->Iterate(MapArgsAllocIterator, callback);
}
// Allocation context profile data iteration callback
@@ -181,6 +182,16 @@ class HeapProfileTable {
// Caller must call ReleaseSnapshot() on result when no longer needed.
Snapshot* NonLiveSnapshot(Snapshot* base);
+ // Refresh the internal mmap information from MemoryRegionMap. Results of
+ // FillOrderedProfile and IterateOrderedAllocContexts will contain mmap'ed
+ // memory regions as at calling RefreshMMapData.
+ void RefreshMMapData();
+
+ // Clear the internal mmap information. Results of FillOrderedProfile and
+ // IterateOrderedAllocContexts won't contain mmap'ed memory regions after
+ // calling ClearMMapData.
+ void ClearMMapData();
+
private:
// data types ----------------------------
@@ -258,9 +269,18 @@ class HeapProfileTable {
const char* extra,
Stats* profile_stats);
- // Get the bucket for the caller stack trace 'key' of depth 'depth'
- // creating the bucket if needed.
- Bucket* GetBucket(int depth, const void* const key[]);
+ // Deallocate a given allocation map.
+ void DeallocateAllocationMap(AllocationMap* allocation);
+
+ // Deallocate a given bucket table.
+ void DeallocateBucketTable(Bucket** table);
+
+ // Get the bucket for the caller stack trace 'key' of depth 'depth' from a
+ // bucket hash map 'table' creating the bucket if needed. '*bucket_count'
+ // is incremented both when 'bucket_count' is not NULL and when a new
+ // bucket object is created.
+ Bucket* GetBucket(int depth, const void* const key[], Bucket** table,
+ int* bucket_count);
// Helper for IterateAllocs to do callback signature conversion
// from AllocationMap::Iterate to AllocIterator.
@@ -280,9 +300,14 @@ class HeapProfileTable {
inline static void DumpNonLiveIterator(const void* ptr, AllocValue* v,
const DumpArgs& args);
+ // Helper for filling size variables in buckets by zero.
+ inline static void ZeroBucketCountsIterator(
+ const void* ptr, AllocValue* v, HeapProfileTable* heap_profile);
+
// Helper for IterateOrderedAllocContexts and FillOrderedProfile.
- // Creates a sorted list of Buckets whose length is num_buckets_.
- // The caller is responsible for dellocating the returned list.
+ // Creates a sorted list of Buckets whose length is num_alloc_buckets_ +
+ // num_avaliable_mmap_buckets_.
+ // The caller is responsible for deallocating the returned list.
Bucket** MakeSortedBucketList() const;
// Helper for TakeSnapshot. Saves object to snapshot.
@@ -314,17 +339,25 @@ class HeapProfileTable {
// Overall profile stats; we use only the Stats part,
// but make it a Bucket to pass to UnparseBucket.
+ // It doesn't contain mmap'ed regions.
Bucket total_;
- // Bucket hash table.
+ // Bucket hash table for malloc.
// We hand-craft one instead of using one of the pre-written
// ones because we do not want to use malloc when operating on the table.
// It is only few lines of code, so no big deal.
- Bucket** table_;
- int num_buckets_;
-
- // Map of all currently allocated objects we know about.
- AllocationMap* allocation_;
+ Bucket** alloc_table_;
+ int num_alloc_buckets_;
+
+ // Bucket hash table for mmap.
+ // This table is filled with the information from MemoryRegionMap by calling
+ // RefreshMMapData.
+ Bucket** mmap_table_;
+ int num_available_mmap_buckets_;
+
+ // Map of all currently allocated objects and mapped regions we know about.
+ AllocationMap* alloc_address_map_;
+ AllocationMap* mmap_address_map_;
DISALLOW_COPY_AND_ASSIGN(HeapProfileTable);
};
« no previous file with comments | « no previous file | third_party/tcmalloc/chromium/src/heap-profile-table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698