Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2516)

Unified Diff: content/renderer/render_thread_impl.cc

Issue 2569753002: Iterate CRT heap instead of process heap. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/render_thread_impl.cc
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index d3d457c8c0b27bd8f71b09411446a132b43f98d5..4012f0f31517e560ac13692479386a68394bb083 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698