Advertisement
Guest User

Untitled

a guest
Jun 22nd, 2016
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. HANDLE heaps[1024];
  2. int i;
  3. int maxNumberOfHeaps = 1024;
  4. int numberOfHeaps;
  5. PROCESS_HEAP_ENTRY heapinfo;
  6.  
  7. numberOfHeaps = GetProcessHeaps(maxNumberOfHeaps, heaps);
  8. heaptotal = 0;
  9. for(i=0; i < numberOfHeaps; ++i)
  10. {
  11. int numblocks = 0;
  12. int numregions = 0;
  13. int numuncommitted = 0;
  14. int thisheaptotal = 0;
  15. int thisheapuncommitted = 0;
  16.  
  17. memset(&heapinfo, 0, sizeof(heapinfo));
  18. heapinfo.lpData = NULL;
  19.  
  20. while(HeapWalk(heaps[i], &heapinfo)) {
  21. if(heapinfo.wFlags & PROCESS_HEAP_REGION)
  22. {
  23. numregions++;
  24. thisheaptotal += heapinfo.Region.dwCommittedSize;
  25. thisheapuncommitted += heapinfo.Region.dwUnCommittedSize;
  26. }
  27. numblocks++;
  28. }
  29. heaptotal += thisheaptotal;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement