| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/trace_event/malloc_dump_provider.h" | 5 #include "base/trace_event/malloc_dump_provider.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/allocator/allocator_extension.h" | 9 #include "base/allocator/allocator_extension.h" |
| 10 #include "base/allocator/allocator_shim.h" | 10 #include "base/allocator/allocator_shim.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 WinHeapMemoryDumpImpl(&main_heap_info); | 215 WinHeapMemoryDumpImpl(&main_heap_info); |
| 216 total_virtual_size = | 216 total_virtual_size = |
| 217 main_heap_info.committed_size + main_heap_info.uncommitted_size; | 217 main_heap_info.committed_size + main_heap_info.uncommitted_size; |
| 218 // Resident size is approximated with committed heap size. Note that it is | 218 // Resident size is approximated with committed heap size. Note that it is |
| 219 // possible to do this with better accuracy on windows by intersecting the | 219 // possible to do this with better accuracy on windows by intersecting the |
| 220 // working set with the virtual memory ranges occuipied by the heap. It's not | 220 // working set with the virtual memory ranges occuipied by the heap. It's not |
| 221 // clear that this is worth it, as it's fairly expensive to do. | 221 // clear that this is worth it, as it's fairly expensive to do. |
| 222 resident_size = main_heap_info.committed_size; | 222 resident_size = main_heap_info.committed_size; |
| 223 allocated_objects_size = main_heap_info.allocated_size; | 223 allocated_objects_size = main_heap_info.allocated_size; |
| 224 allocated_objects_count = main_heap_info.block_count; | 224 allocated_objects_count = main_heap_info.block_count; |
| 225 #elif defined(OS_FUCHSIA) |
| 226 // TODO(scottmg): Port. |
| 225 #else | 227 #else |
| 226 struct mallinfo info = mallinfo(); | 228 struct mallinfo info = mallinfo(); |
| 227 DCHECK_GE(info.arena + info.hblkhd, info.uordblks); | 229 DCHECK_GE(info.arena + info.hblkhd, info.uordblks); |
| 228 | 230 |
| 229 // In case of Android's jemalloc |arena| is 0 and the outer pages size is | 231 // In case of Android's jemalloc |arena| is 0 and the outer pages size is |
| 230 // reported by |hblkhd|. In case of dlmalloc the total is given by | 232 // reported by |hblkhd|. In case of dlmalloc the total is given by |
| 231 // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF. | 233 // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF. |
| 232 total_virtual_size = info.arena + info.hblkhd; | 234 total_virtual_size = info.arena + info.hblkhd; |
| 233 resident_size = info.uordblks; | 235 resident_size = info.uordblks; |
| 234 | 236 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 tid_dumping_heap_ == PlatformThread::CurrentId()) | 353 tid_dumping_heap_ == PlatformThread::CurrentId()) |
| 352 return; | 354 return; |
| 353 AutoLock lock(allocation_register_lock_); | 355 AutoLock lock(allocation_register_lock_); |
| 354 if (!allocation_register_) | 356 if (!allocation_register_) |
| 355 return; | 357 return; |
| 356 allocation_register_->Remove(address); | 358 allocation_register_->Remove(address); |
| 357 } | 359 } |
| 358 | 360 |
| 359 } // namespace trace_event | 361 } // namespace trace_event |
| 360 } // namespace base | 362 } // namespace base |
| OLD | NEW |