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

Unified Diff: Source/wtf/PartitionAllocTest.cpp

Issue 1153473011: For large (but not direct mapped) allocations, track the real allocation size. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More review feedback. Created 5 years, 6 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 | « Source/wtf/PartitionAlloc.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/PartitionAllocTest.cpp
diff --git a/Source/wtf/PartitionAllocTest.cpp b/Source/wtf/PartitionAllocTest.cpp
index 32660794557d02daf49f5ca0b5c329fbf3e7ec74..5fd06b0be91d4749e6db7787b32b7243f26285ab 100644
--- a/Source/wtf/PartitionAllocTest.cpp
+++ b/Source/wtf/PartitionAllocTest.cpp
@@ -1473,6 +1473,33 @@ TEST(PartitionAllocTest, DumpMemoryStats)
partitionFreeGeneric(genericAllocator.root(), ptr2);
}
+ // This test checks large-but-not-quite-direct allocations.
+ {
+ void* ptr = partitionAllocGeneric(genericAllocator.root(), 65537);
+
+ {
+ MockPartitionStatsDumper mockStatsDumperGeneric;
+ partitionDumpStatsGeneric(genericAllocator.root(), "mock_generic_allocator", &mockStatsDumperGeneric);
+ EXPECT_TRUE(mockStatsDumperGeneric.IsMemoryAllocationRecorded());
+
+ size_t slotSize = 65536 + (65536 / WTF::kGenericNumBucketsPerOrder);
+ const WTF::PartitionBucketMemoryStats* stats = mockStatsDumperGeneric.GetBucketStats(slotSize);
+ EXPECT_TRUE(stats);
+ EXPECT_TRUE(stats->isValid);
+ EXPECT_FALSE(stats->isDirectMap);
+ EXPECT_EQ(slotSize, stats->bucketSlotSize);
+ EXPECT_EQ(65536 + WTF::kSystemPageSize, stats->activeBytes);
+ EXPECT_EQ(slotSize, stats->residentBytes);
+ EXPECT_EQ(0u, stats->freeableBytes);
+ EXPECT_EQ(1u, stats->numFullPages);
+ EXPECT_EQ(0u, stats->numActivePages);
+ EXPECT_EQ(0u, stats->numEmptyPages);
+ EXPECT_EQ(0u, stats->numDecommittedPages);
+ }
+
+ partitionFreeGeneric(genericAllocator.root(), ptr);
+ }
+
TestShutdown();
}
« no previous file with comments | « Source/wtf/PartitionAlloc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698