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

Unified Diff: src/base/platform/platform.h

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 | « no previous file | src/base/platform/platform-linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/base/platform/platform.h
diff --git a/src/base/platform/platform.h b/src/base/platform/platform.h
index 9464fb11231dbcd59efed2846ff4d4894681f83f..77c8d96056d38ccfa4a6dd21b4d07eaf5c89cb59 100644
--- a/src/base/platform/platform.h
+++ b/src/base/platform/platform.h
@@ -337,6 +337,22 @@ class VirtualMemory {
// Creates a single guard page at the given address.
bool Guard(void* address);
+ // Releases the tail [free_start, free_start + size] of a previously allocated
ulan 2016/06/06 15:53:15 Should be [free_start, size_]
Hannes Payer (out of office) 2016/06/06 15:56:38 Done.
+ // chunk of memory.
+ void ReleasePartial(void* free_start) {
+ DCHECK(IsReserved());
+ // Notice: Order is important here. The VirtualMemory object might live
+ // inside the allocated region.
+ size_t size = size_ - (reinterpret_cast<size_t>(free_start) -
+ reinterpret_cast<size_t>(address_));
+ CHECK(InVM(free_start, size));
+ DCHECK(free_start != address_);
ulan 2016/06/06 15:53:15 DCHECK_LT(address_, free_start); DCHECK_LT(free_st
Hannes Payer (out of office) 2016/06/06 15:56:38 Done.
+ bool result = ReleasePartialRegion(address_, size_, free_start, size);
+ USE(result);
+ DCHECK(result);
+ size_ -= size;
+ }
+
void Release() {
DCHECK(IsReserved());
// Notice: Order is important here. The VirtualMemory object might live
@@ -369,6 +385,12 @@ class VirtualMemory {
// and the same size it was reserved with.
static bool ReleaseRegion(void* base, size_t size);
+ // Must be called with a base pointer that has been returned by ReserveRegion
+ // and the same size it was reserved with.
+ // [free_start, free_start + free_size] is the memory that will be released.
+ static bool ReleasePartialRegion(void* base, size_t size, void* free_start,
+ size_t free_size);
+
// Returns true if OS performs lazy commits, i.e. the memory allocation call
// defers actual physical memory allocation till the first memory access.
// Otherwise returns false.
« no previous file with comments | « no previous file | src/base/platform/platform-linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698