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

Unified Diff: test/cctest/heap/test-heap.cc

Issue 2032393002: [heap] Uncommit unused large object page memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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 | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index 1b87564516c30aae876b7e31047ec3fdc29abfe7..7ee0c360ca92f20066c335b629abb69df2355166 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -6760,5 +6760,28 @@ TEST(Regress615489) {
CHECK_LE(size_after, size_before);
}
+TEST(UncommitUnusedLargeObjectMemory) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Heap* heap = CcTest::heap();
+ Isolate* isolate = heap->isolate();
+
+ Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000);
+ MemoryChunk* chunk = MemoryChunk::FromAddress(array->address());
+ CHECK(chunk->owner()->identity() == LO_SPACE);
+
+ intptr_t size_before = array->Size();
+ size_t committed_memory_before = chunk->CommittedPhysicalMemory();
+
+ array->Shrink(1);
+ CHECK(array->Size() < size_before);
+
+ CcTest::heap()->CollectAllGarbage();
+ CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before);
+ size_t shrinked_size =
+ RoundUp((array->address() - chunk->address()) + array->Size(),
+ base::OS::CommitPageSize());
+ CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory());
+}
} // namespace internal
} // namespace v8
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698