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

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

Issue 9323026: [NOT TO COMMIT!] r109: Diff of the current tcmalloc from the original google-perftools r109. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 8 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
« no previous file with comments | « third_party/tcmalloc/chromium/src/common.h ('k') | third_party/tcmalloc/chromium/src/config.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
diff --git a/third_party/tcmalloc/chromium/src/common.cc b/third_party/tcmalloc/chromium/src/common.cc
index 8221b0869f45e9ead12a51ed44c9dbfb2e33c62f..69514b6f4d08f5363015c4f98754312d8465367f 100644
--- a/third_party/tcmalloc/chromium/src/common.cc
+++ b/third_party/tcmalloc/chromium/src/common.cc
@@ -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
@@ -106,7 +110,7 @@ void SizeMap::Init() {
int alignment = kAlignment;
CHECK_CONDITION(kAlignment <= 16);
int last_lg = -1;
- for (size_t size = kAlignment; size <= kMaxSize; size += alignment) {
+ for (size_t size = kMinClassSize; size <= kMaxSize; size += alignment) {
int lg = LgFloor(size);
if (lg > last_lg) {
// Increase alignment every so often to reduce number of size classes.
@@ -201,7 +205,13 @@ void SizeMap::Dump(TCMalloc_Printer* out) {
// 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;
}
@@ -210,4 +220,8 @@ void* MetaDataAlloc(size_t bytes) {
uint64_t metadata_system_bytes() { return metadata_system_bytes_; }
+void increment_metadata_system_bytes(size_t bytes) {
+ metadata_system_bytes_ += bytes;
+}
+
} // namespace tcmalloc
« no previous file with comments | « third_party/tcmalloc/chromium/src/common.h ('k') | third_party/tcmalloc/chromium/src/config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698