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

Unified Diff: base/memory/discardable_memory_unittest.cc

Issue 655003003: base: Add discardable memory test that check behavior when creating enough instances that could use… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on 659143002 Created 6 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/discardable_memory_unittest.cc
diff --git a/base/memory/discardable_memory_unittest.cc b/base/memory/discardable_memory_unittest.cc
index 2bdc0795d18ba87ef701b74d87db05fd3716275c..600475ee06bc92e0fd51254761b7b9f6600b897e 100644
--- a/base/memory/discardable_memory_unittest.cc
+++ b/base/memory/discardable_memory_unittest.cc
@@ -103,6 +103,22 @@ TEST_P(DiscardableMemoryTest, UnlockedMemoryAccessCrashesInDebugMode) {
}
#endif
+// Test behavior when creating enough instances that could use up a 32-bit
+// address space.
+TEST_P(DiscardableMemoryTest, AddressSpace) {
+ const size_t kLargeSize = 4 * 1024 * 1024; // 4MiB.
+ const size_t kNumberOfInstances = 1024 + 1; // >4GiB total.
+
+ scoped_ptr<DiscardableMemory> instances[kNumberOfInstances];
+ for (auto& memory : instances) {
+ memory = CreateLockedMemory(kLargeSize);
+ ASSERT_TRUE(memory);
+ void* addr = memory->Memory();
+ ASSERT_NE(nullptr, addr);
+ memory->Unlock();
+ }
+}
+
std::vector<DiscardableMemoryType> GetSupportedDiscardableMemoryTypes() {
std::vector<DiscardableMemoryType> supported_types;
DiscardableMemory::GetSupportedTypes(&supported_types);
« 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