|
// stdafx.cpp : source file that includes just the standard includes
// Dir.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
long GetHeapSize()
{
DWORD blocks = 0;
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPHEAPLIST, 0);
if (((int) snapshot) != -1) {
HEAPLIST32 hl = {sizeof(hl)};
HEAPENTRY32 he;
for (BOOL fOKHL = Heap32ListFirst(snapshot, &hl); fOKHL;
fOKHL = Heap32ListNext(snapshot, &hl))
{
memset(&he, 0, sizeof(he));
he.dwSize = sizeof(he);
BOOL fOKHE = Heap32First(&he, 0, hl.th32HeapID);
for (; fOKHE; fOKHE = Heap32Next(&he))
{
if ((he.dwFlags & LF32_FREE) == 0)
{
blocks += he.dwBlockSize;
}
}
}
CloseHandle(snapshot);
}
return blocks;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Began programming in 1968 on a Wang 720. Move to Fortran and began developing FEM (finite element model) applications on an IBM 360 in 1973. Developed custom FEM editors for most of my career until 1995.