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

Unified Diff: third_party/tcmalloc/chromium/src/page_heap.cc

Issue 11857007: TCMalloc: restrict maximum size of memory ranges (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
Index: third_party/tcmalloc/chromium/src/page_heap.cc
diff --git a/third_party/tcmalloc/chromium/src/page_heap.cc b/third_party/tcmalloc/chromium/src/page_heap.cc
index 402dc1f9e8a9a9421beb91cfbdcc28119a37f9b1..910cfd131a9f24b31f80a2a3e350ffa851b08c82 100644
--- a/third_party/tcmalloc/chromium/src/page_heap.cc
+++ b/third_party/tcmalloc/chromium/src/page_heap.cc
@@ -467,6 +467,11 @@ bool PageHeap::GrowHeap(Length n) {
ASSERT(kMaxPages >= kMinSystemAlloc);
if (n > kMaxValidPages) return false;
Length ask = (n>kMinSystemAlloc) ? n : static_cast<Length>(kMinSystemAlloc);
+ // For most allocators it's ok to check for size here as they won't generally
+ // grow existing mappings. Some implementations, such as the Linux brk heap
+ // implementation will however require additional checks.
+ if (!IsContiguousAllocSizePermitted(n << kPageShift))
jln (very slow on Chromium) 2013/01/11 06:02:29 It's a bit ugly to have the check here *and* in th
+ return false;
size_t actual_size;
void* ptr = TCMalloc_SystemAlloc(ask << kPageShift, &actual_size, kPageSize);
if (ptr == NULL) {

Powered by Google App Engine
This is Rietveld 408576698