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

Unified Diff: src/heap/spaces.cc

Issue 2418733002: [heap] Fix MemoryAllocator::AllocateAlignedMemory. (Closed)
Patch Set: Created 4 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: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index 604d32152f1356678f856ba2e4f6df2b92201436..e13f0891733b323954f5a4552933f6fa92c5c772 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -459,7 +459,10 @@ Address MemoryAllocator::AllocateAlignedMemory(
DCHECK(commit_size <= reserve_size);
base::VirtualMemory reservation;
Address base = ReserveAlignedMemory(reserve_size, alignment, &reservation);
- if (base == NULL) return NULL;
+ if (base == NULL) {
+ size_.Decrement(reserve_size);
Michael Lippautz 2016/10/13 08:24:36 IIUC ReserveAlignedMemory only increments if it su
Ilija.Pavlovic1 2016/10/13 12:29:58 This Decrement will be removed. Done.
+ return NULL;
+ }
if (executable == EXECUTABLE) {
if (!CommitExecutableMemory(&reservation, base, commit_size,
@@ -478,6 +481,7 @@ Address MemoryAllocator::AllocateAlignedMemory(
// Failed to commit the body. Release the mapping and any partially
// commited regions inside it.
reservation.Release();
+ size_.Decrement(reserve_size);
return NULL;
}
« 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