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

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

Issue 9310021: [NOT TO COMMIT!] Merge Chromium-specific changes in tcmalloc thru. the original gperftools r136. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fixed some build inhibitor. 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.in » ('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 dad7372ffefe789561e18ae3a24100e5a58634d2..dd175f223692a5adb37048140b30422bae79fe40 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
@@ -111,7 +115,7 @@ void SizeMap::Init() {
int sc = 1; // Next size class to assign
int alignment = kAlignment;
CHECK_CONDITION(kAlignment <= 16);
- for (size_t size = kAlignment; size <= kMaxSize; size += alignment) {
+ for (size_t size = kMinClassSize; size <= kMaxSize; size += alignment) {
alignment = AlignmentForSize(size);
CHECK_CONDITION((size % alignment) == 0);
@@ -190,7 +194,13 @@ void SizeMap::Init() {
// 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;
}
@@ -199,4 +209,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.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698