Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- HANDLE heaps[1024];
- int i;
- int maxNumberOfHeaps = 1024;
- int numberOfHeaps;
- PROCESS_HEAP_ENTRY heapinfo;
- numberOfHeaps = GetProcessHeaps(maxNumberOfHeaps, heaps);
- heaptotal = 0;
- for(i=0; i < numberOfHeaps; ++i)
- {
- int numblocks = 0;
- int numregions = 0;
- int numuncommitted = 0;
- int thisheaptotal = 0;
- int thisheapuncommitted = 0;
- memset(&heapinfo, 0, sizeof(heapinfo));
- heapinfo.lpData = NULL;
- while(HeapWalk(heaps[i], &heapinfo)) {
- if(heapinfo.wFlags & PROCESS_HEAP_REGION)
- {
- numregions++;
- thisheaptotal += heapinfo.Region.dwCommittedSize;
- thisheapuncommitted += heapinfo.Region.dwUnCommittedSize;
- }
- numblocks++;
- }
- heaptotal += thisheaptotal;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement