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

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

Issue 8570023: Add a guard page in front of metadata allocations. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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 | « no previous file | third_party/tcmalloc/chromium/src/page_heap_allocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/common.cc
===================================================================
--- third_party/tcmalloc/chromium/src/common.cc (revision 110522)
+++ third_party/tcmalloc/chromium/src/common.cc (working copy)
@@ -34,6 +34,10 @@
#include "common.h"
#include "system-alloc.h"
+#if defined(HAVE_UNISTD_H) && defined(HAVE_GETPAGESIZE)
+#include <unistd.h> // for getpagesize
+#endif
+
namespace tcmalloc {
// Note: the following only works for "n"s that fit in 32-bits, but
@@ -201,7 +205,13 @@
// Metadata allocator -- keeps stats about how many bytes allocated.
static uint64_t metadata_system_bytes_ = 0;
void* MetaDataAlloc(size_t bytes) {
- void* result = TCMalloc_SystemAlloc(bytes, NULL);
+ static size_t pagesize;
+#ifdef HAVE_GETPAGESIZE
+ if (pagesize == 0)
+ pagesize = getpagesize();
+#endif
+
+ void* result = TCMalloc_SystemAlloc(bytes, NULL, pagesize);
if (result != NULL) {
metadata_system_bytes_ += bytes;
}
« no previous file with comments | « no previous file | third_party/tcmalloc/chromium/src/page_heap_allocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698