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

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

Issue 9667026: Revert 126020 - Experiment for updating the tcmalloc chromium branch to r144 (gperftools 2.0). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2008, Google Inc. 1 // Copyright (c) 2008, 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
(...skipping 16 matching lines...) Expand all
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 29
30 // --- 30 // ---
31 // Author: Ken Ashcraft <opensource@google.com> 31 // Author: Ken Ashcraft <opensource@google.com>
32 32
33 #include "static_vars.h" 33 #include "static_vars.h"
34 #include <stddef.h> // for NULL 34 #include <stddef.h> // for NULL
35 #include <new> // for operator new 35 #include <new> // for operator new
36 #include "internal_logging.h" // for CHECK_CONDITION 36 #include "internal_logging.h" // for CHECK_CONDITION
37 #include "common.h"
38 #include "sampler.h" // for Sampler 37 #include "sampler.h" // for Sampler
39 38
40 namespace tcmalloc { 39 namespace tcmalloc {
41 40
42 SpinLock Static::pageheap_lock_(SpinLock::LINKER_INITIALIZED); 41 SpinLock Static::pageheap_lock_(SpinLock::LINKER_INITIALIZED);
43 SizeMap Static::sizemap_; 42 SizeMap Static::sizemap_;
44 CentralFreeListPadded Static::central_cache_[kNumClasses]; 43 CentralFreeListPadded Static::central_cache_[kNumClasses];
45 PageHeapAllocator<Span> Static::span_allocator_; 44 PageHeapAllocator<Span> Static::span_allocator_;
46 PageHeapAllocator<StackTrace> Static::stacktrace_allocator_; 45 PageHeapAllocator<StackTrace> Static::stacktrace_allocator_;
47 Span Static::sampled_objects_; 46 Span Static::sampled_objects_;
48 PageHeapAllocator<StackTraceTable::Bucket> Static::bucket_allocator_; 47 PageHeapAllocator<StackTraceTable::Bucket> Static::bucket_allocator_;
49 StackTrace* Static::growth_stacks_ = NULL; 48 StackTrace* Static::growth_stacks_ = NULL;
50 PageHeap* Static::pageheap_ = NULL; 49 char Static::pageheap_memory_[sizeof(PageHeap)];
51 50
52 void Static::InitStaticVars() { 51 void Static::InitStaticVars() {
53 sizemap_.Init(); 52 sizemap_.Init();
54 span_allocator_.Init(); 53 span_allocator_.Init();
55 span_allocator_.New(); // Reduce cache conflicts 54 span_allocator_.New(); // Reduce cache conflicts
56 span_allocator_.New(); // Reduce cache conflicts 55 span_allocator_.New(); // Reduce cache conflicts
57 stacktrace_allocator_.Init(); 56 stacktrace_allocator_.Init();
58 bucket_allocator_.Init(); 57 bucket_allocator_.Init();
59 // Do a bit of sanitizing: make sure central_cache is aligned properly 58 // Do a bit of sanitizing: make sure central_cache is aligned properly
60 CHECK_CONDITION((sizeof(central_cache_[0]) % 64) == 0); 59 CHECK_CONDITION((sizeof(central_cache_[0]) % 64) == 0);
61 for (int i = 0; i < kNumClasses; ++i) { 60 for (int i = 0; i < kNumClasses; ++i) {
62 central_cache_[i].Init(i); 61 central_cache_[i].Init(i);
63 } 62 }
64 // It's important to have PageHeap allocated, not in static storage, 63 new ((void*)pageheap_memory_) PageHeap;
65 // so that HeapLeakChecker does not consider all the byte patterns stored
66 // in is caches as pointers that are sources of heap object liveness,
67 // which leads to it missing some memory leaks.
68 pageheap_ = new (MetaDataAlloc(sizeof(PageHeap))) PageHeap;
69 DLL_Init(&sampled_objects_); 64 DLL_Init(&sampled_objects_);
70 Sampler::InitStatics(); 65 Sampler::InitStatics();
71 } 66 }
72 67
73 } // namespace tcmalloc 68 } // namespace tcmalloc
OLDNEW
« no previous file with comments | « third_party/tcmalloc/chromium/src/static_vars.h ('k') | third_party/tcmalloc/chromium/src/symbolize.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698