OLD | NEW |
1 // Copyright (c) 2005, 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 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 #include "malloc_hook-inl.h" // for MallocHook::InvokeNewHook, etc | 124 #include "malloc_hook-inl.h" // for MallocHook::InvokeNewHook, etc |
125 #include "page_heap.h" // for PageHeap, PageHeap::Stats | 125 #include "page_heap.h" // for PageHeap, PageHeap::Stats |
126 #include "page_heap_allocator.h" // for PageHeapAllocator | 126 #include "page_heap_allocator.h" // for PageHeapAllocator |
127 #include "span.h" // for Span, DLL_Prepend, etc | 127 #include "span.h" // for Span, DLL_Prepend, etc |
128 #include "stack_trace_table.h" // for StackTraceTable | 128 #include "stack_trace_table.h" // for StackTraceTable |
129 #include "static_vars.h" // for Static | 129 #include "static_vars.h" // for Static |
130 #include "system-alloc.h" // for DumpSystemAllocatorStats, etc | 130 #include "system-alloc.h" // for DumpSystemAllocatorStats, etc |
131 #include "tcmalloc_guard.h" // for TCMallocGuard | 131 #include "tcmalloc_guard.h" // for TCMallocGuard |
132 #include "thread_cache.h" // for ThreadCache | 132 #include "thread_cache.h" // for ThreadCache |
133 | 133 |
134 // We only need malloc.h for struct mallinfo. | |
135 #ifdef HAVE_STRUCT_MALLINFO | |
136 // Malloc can be in several places on older versions of OS X. | |
137 # if defined(HAVE_MALLOC_H) | |
138 # include <malloc.h> | |
139 # elif defined(HAVE_SYS_MALLOC_H) | |
140 # include <sys/malloc.h> | |
141 # elif defined(HAVE_MALLOC_MALLOC_H) | |
142 # include <malloc/malloc.h> | |
143 # endif | |
144 #endif | |
145 | |
146 #if (defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)) && !defi
ned(WIN32_OVERRIDE_ALLOCATORS) | 134 #if (defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)) && !defi
ned(WIN32_OVERRIDE_ALLOCATORS) |
147 # define WIN32_DO_PATCHING 1 | 135 # define WIN32_DO_PATCHING 1 |
148 #endif | 136 #endif |
149 | 137 |
150 // Some windows file somewhere (at least on cygwin) #define's small (!) | 138 // Some windows file somewhere (at least on cygwin) #define's small (!) |
151 // For instance, <windows.h> appears to have "#define small char". | 139 // For instance, <windows.h> appears to have "#define small char". |
152 #undef small | 140 #undef small |
153 | 141 |
154 using STL_NAMESPACE::max; | 142 using STL_NAMESPACE::max; |
155 using STL_NAMESPACE::numeric_limits; | 143 using STL_NAMESPACE::numeric_limits; |
(...skipping 1710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1866 *mark = ~allocated_mark; // Distinctively not allocated. | 1854 *mark = ~allocated_mark; // Distinctively not allocated. |
1867 } | 1855 } |
1868 | 1856 |
1869 static void MarkAllocatedRegion(void* ptr) { | 1857 static void MarkAllocatedRegion(void* ptr) { |
1870 if (ptr == NULL) return; | 1858 if (ptr == NULL) return; |
1871 MarkType* mark = GetMarkLocation(ptr); | 1859 MarkType* mark = GetMarkLocation(ptr); |
1872 *mark = GetMarkValue(ptr, mark); | 1860 *mark = GetMarkValue(ptr, mark); |
1873 } | 1861 } |
1874 | 1862 |
1875 #endif // TCMALLOC_VALIDATION | 1863 #endif // TCMALLOC_VALIDATION |
OLD | NEW |