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 <unordered_map> | 9 #include <unordered_map> |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 WinHeapMemoryDumpImpl(&main_heap_info); | 235 WinHeapMemoryDumpImpl(&main_heap_info); |
236 total_virtual_size = | 236 total_virtual_size = |
237 main_heap_info.committed_size + main_heap_info.uncommitted_size; | 237 main_heap_info.committed_size + main_heap_info.uncommitted_size; |
238 // Resident size is approximated with committed heap size. Note that it is | 238 // Resident size is approximated with committed heap size. Note that it is |
239 // possible to do this with better accuracy on windows by intersecting the | 239 // possible to do this with better accuracy on windows by intersecting the |
240 // working set with the virtual memory ranges occuipied by the heap. It's not | 240 // working set with the virtual memory ranges occuipied by the heap. It's not |
241 // clear that this is worth it, as it's fairly expensive to do. | 241 // clear that this is worth it, as it's fairly expensive to do. |
242 resident_size = main_heap_info.committed_size; | 242 resident_size = main_heap_info.committed_size; |
243 allocated_objects_size = main_heap_info.allocated_size; | 243 allocated_objects_size = main_heap_info.allocated_size; |
244 allocated_objects_count = main_heap_info.block_count; | 244 allocated_objects_count = main_heap_info.block_count; |
| 245 #elif defined(OS_FUCHSIA) |
| 246 // TODO(fuchsia): Port, see https://crbug.com/706592. |
245 #else | 247 #else |
246 struct mallinfo info = mallinfo(); | 248 struct mallinfo info = mallinfo(); |
247 DCHECK_GE(info.arena + info.hblkhd, info.uordblks); | 249 DCHECK_GE(info.arena + info.hblkhd, info.uordblks); |
248 | 250 |
249 // In case of Android's jemalloc |arena| is 0 and the outer pages size is | 251 // In case of Android's jemalloc |arena| is 0 and the outer pages size is |
250 // reported by |hblkhd|. In case of dlmalloc the total is given by | 252 // reported by |hblkhd|. In case of dlmalloc the total is given by |
251 // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF. | 253 // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF. |
252 total_virtual_size = info.arena + info.hblkhd; | 254 total_virtual_size = info.arena + info.hblkhd; |
253 resident_size = info.uordblks; | 255 resident_size = info.uordblks; |
254 | 256 |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 tid_dumping_heap_ == PlatformThread::CurrentId()) | 386 tid_dumping_heap_ == PlatformThread::CurrentId()) |
385 return; | 387 return; |
386 AutoLock lock(allocation_register_lock_); | 388 AutoLock lock(allocation_register_lock_); |
387 if (!allocation_register_) | 389 if (!allocation_register_) |
388 return; | 390 return; |
389 allocation_register_->Remove(address); | 391 allocation_register_->Remove(address); |
390 } | 392 } |
391 | 393 |
392 } // namespace trace_event | 394 } // namespace trace_event |
393 } // namespace base | 395 } // namespace base |
OLD | NEW |