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

Unified Diff: src/heap/spaces.cc

Issue 2472573003: [heap] Fix Unmapper::TearDown to include delayed chunks (Closed)
Patch Set: Created 4 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 | « src/heap/spaces.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 17d2a70144b271c767270d2c87dbef185dec6042..7bcc65d5f9c8ed0177dc0c9d9d3087e13ea5b370 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -311,13 +311,7 @@ bool MemoryAllocator::SetUp(intptr_t capacity, intptr_t capacity_executable,
void MemoryAllocator::TearDown() {
- unmapper()->WaitUntilCompleted();
-
- MemoryChunk* chunk = nullptr;
- while ((chunk = unmapper()->TryGetPooledMemoryChunkSafe()) != nullptr) {
- FreeMemory(reinterpret_cast<Address>(chunk), MemoryChunk::kPageSize,
- NOT_EXECUTABLE);
- }
+ unmapper()->TearDown();
// Check that spaces were torn down before MemoryAllocator.
DCHECK_EQ(size_.Value(), 0);
@@ -384,6 +378,13 @@ void MemoryAllocator::Unmapper::PerformFreeMemoryOnQueuedChunks() {
}
}
+void MemoryAllocator::Unmapper::TearDown() {
+ WaitUntilCompleted();
+ ReconsiderDelayedChunks();
+ CHECK(delayed_regular_chunks_.empty());
+ PerformFreeMemoryOnQueuedChunks();
+}
+
void MemoryAllocator::Unmapper::ReconsiderDelayedChunks() {
std::list<MemoryChunk*> delayed_chunks(std::move(delayed_regular_chunks_));
// Move constructed, so the permanent list should be empty.
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698