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

Side by Side Diff: third_party/tcmalloc/chromium/src/malloc_extension.cc

Issue 10855010: Reverting this to see if it fixes the redness on the ChromiumOS bots. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, Google Inc. 1 // Copyright (c) 2005, Google Inc.
2 // All rights reserved. 2 // All rights reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // * Redistributions of source code must retain the above copyright 8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer. 9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above 10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer 11 // copyright notice, this list of conditions and the following disclaimer
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #endif 43 #endif
44 #include <string> 44 #include <string>
45 #include "base/dynamic_annotations.h" 45 #include "base/dynamic_annotations.h"
46 #include "base/sysinfo.h" // for FillProcSelfMaps 46 #include "base/sysinfo.h" // for FillProcSelfMaps
47 #ifndef NO_HEAP_CHECK 47 #ifndef NO_HEAP_CHECK
48 #include "gperftools/heap-checker.h" 48 #include "gperftools/heap-checker.h"
49 #endif 49 #endif
50 #include "gperftools/malloc_extension.h" 50 #include "gperftools/malloc_extension.h"
51 #include "gperftools/malloc_extension_c.h" 51 #include "gperftools/malloc_extension_c.h"
52 #include "maybe_threads.h" 52 #include "maybe_threads.h"
53 #include "thread_cache.h"
54 53
55 using STL_NAMESPACE::string; 54 using STL_NAMESPACE::string;
56 using STL_NAMESPACE::vector; 55 using STL_NAMESPACE::vector;
57 56
58 static void DumpAddressMap(string* result) { 57 static void DumpAddressMap(string* result) {
59 *result += "\nMAPPED_LIBRARIES:\n"; 58 *result += "\nMAPPED_LIBRARIES:\n";
60 // We keep doubling until we get a fit 59 // We keep doubling until we get a fit
61 const size_t old_resultlen = result->size(); 60 const size_t old_resultlen = result->size();
62 for (int amap_size = 10240; amap_size < 10000000; amap_size *= 2) { 61 for (int amap_size = 10240; amap_size < 10000000; amap_size *= 2) {
63 result->resize(old_resultlen + amap_size); 62 result->resize(old_resultlen + amap_size);
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 // When running under valgrind, our custom malloc is replaced with 213 // When running under valgrind, our custom malloc is replaced with
215 // valgrind's one and malloc extensions will not work. (Note: 214 // valgrind's one and malloc extensions will not work. (Note:
216 // callers should be responsible for checking that they are the 215 // callers should be responsible for checking that they are the
217 // malloc that is really being run, before calling Register. This 216 // malloc that is really being run, before calling Register. This
218 // is just here as an extra sanity check.) 217 // is just here as an extra sanity check.)
219 if (!RunningOnValgrind()) { 218 if (!RunningOnValgrind()) {
220 current_instance = implementation; 219 current_instance = implementation;
221 } 220 }
222 } 221 }
223 222
224 unsigned int MallocExtension::GetBytesAllocatedOnCurrentThread() {
225 return tcmalloc::ThreadCache::GetBytesAllocatedOnCurrentThread();
226 }
227
228 // ----------------------------------------------------------------------- 223 // -----------------------------------------------------------------------
229 // Heap sampling support 224 // Heap sampling support
230 // ----------------------------------------------------------------------- 225 // -----------------------------------------------------------------------
231 226
232 namespace { 227 namespace {
233 228
234 // Accessors 229 // Accessors
235 uintptr_t Count(void** entry) { 230 uintptr_t Count(void** entry) {
236 return reinterpret_cast<uintptr_t>(entry[0]); 231 return reinterpret_cast<uintptr_t>(entry[0]);
237 } 232 }
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 C_SHIM(ReleaseToSystem, void, (size_t num_bytes), (num_bytes)); 363 C_SHIM(ReleaseToSystem, void, (size_t num_bytes), (num_bytes));
369 C_SHIM(GetEstimatedAllocatedSize, size_t, (size_t size), (size)); 364 C_SHIM(GetEstimatedAllocatedSize, size_t, (size_t size), (size));
370 C_SHIM(GetAllocatedSize, size_t, (const void* p), (p)); 365 C_SHIM(GetAllocatedSize, size_t, (const void* p), (p));
371 366
372 // Can't use the shim here because of the need to translate the enums. 367 // Can't use the shim here because of the need to translate the enums.
373 extern "C" 368 extern "C"
374 MallocExtension_Ownership MallocExtension_GetOwnership(const void* p) { 369 MallocExtension_Ownership MallocExtension_GetOwnership(const void* p) {
375 return static_cast<MallocExtension_Ownership>( 370 return static_cast<MallocExtension_Ownership>(
376 MallocExtension::instance()->GetOwnership(p)); 371 MallocExtension::instance()->GetOwnership(p));
377 } 372 }
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698