OLD | NEW |
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 13 matching lines...) Expand all Loading... |
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
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 "sampler.h" // for the init function | 34 #include <stddef.h> // for NULL |
| 35 #include <new> // for operator new |
| 36 #include "internal_logging.h" // for CHECK_CONDITION |
| 37 #include "sampler.h" // for Sampler |
35 | 38 |
36 namespace tcmalloc { | 39 namespace tcmalloc { |
37 | 40 |
38 SpinLock Static::pageheap_lock_(SpinLock::LINKER_INITIALIZED); | 41 SpinLock Static::pageheap_lock_(SpinLock::LINKER_INITIALIZED); |
39 SizeMap Static::sizemap_; | 42 SizeMap Static::sizemap_; |
40 CentralFreeListPadded Static::central_cache_[kNumClasses]; | 43 CentralFreeListPadded Static::central_cache_[kNumClasses]; |
41 PageHeapAllocator<Span> Static::span_allocator_; | 44 PageHeapAllocator<Span> Static::span_allocator_; |
42 PageHeapAllocator<StackTrace> Static::stacktrace_allocator_; | 45 PageHeapAllocator<StackTrace> Static::stacktrace_allocator_; |
43 Span Static::sampled_objects_; | 46 Span Static::sampled_objects_; |
44 PageHeapAllocator<StackTraceTable::Bucket> Static::bucket_allocator_; | 47 PageHeapAllocator<StackTraceTable::Bucket> Static::bucket_allocator_; |
(...skipping 11 matching lines...) Expand all Loading... |
56 CHECK_CONDITION((sizeof(central_cache_[0]) % 64) == 0); | 59 CHECK_CONDITION((sizeof(central_cache_[0]) % 64) == 0); |
57 for (int i = 0; i < kNumClasses; ++i) { | 60 for (int i = 0; i < kNumClasses; ++i) { |
58 central_cache_[i].Init(i); | 61 central_cache_[i].Init(i); |
59 } | 62 } |
60 new ((void*)pageheap_memory_) PageHeap; | 63 new ((void*)pageheap_memory_) PageHeap; |
61 DLL_Init(&sampled_objects_); | 64 DLL_Init(&sampled_objects_); |
62 Sampler::InitStatics(); | 65 Sampler::InitStatics(); |
63 } | 66 } |
64 | 67 |
65 } // namespace tcmalloc | 68 } // namespace tcmalloc |
OLD | NEW |