Commit 7fb93a52 authored by siggi's avatar siggi Committed by Commit bot

Iterate CRT heap instead of process heap.

BUG=671459,671653

Review-Url: https://codereview.chromium.org/2569753002
Cr-Commit-Position: refs/heads/master@{#437930}
parent 74a2272c
......@@ -1811,20 +1811,20 @@ void RenderThreadImpl::OnProcessPurgeAndSuspend() {
namespace {
static size_t GetMallocUsage() {
// Only checks the default process heap.
HANDLE heap = ::GetProcessHeap();
if (heap == NULL)
// Iterate through whichever heap the CRT is using.
HANDLE crt_heap = reinterpret_cast<HANDLE>(_get_heap_handle());
if (crt_heap == NULL)
return 0;
if (!::HeapLock(heap))
if (!::HeapLock(crt_heap))
return 0 ;
size_t malloc_usage = 0;
PROCESS_HEAP_ENTRY heap_entry;
heap_entry.lpData = NULL;
while (::HeapWalk(heap, &heap_entry) != 0) {
while (::HeapWalk(crt_heap, &heap_entry) != 0) {
if ((heap_entry.wFlags & PROCESS_HEAP_ENTRY_BUSY) != 0)
malloc_usage += heap_entry.cbData;
}
::HeapUnlock(heap);
::HeapUnlock(crt_heap);
return malloc_usage;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment