Re: Heap memory available (W32 console app in Visual C++)
"CriCri" wrote:
Does anyone know of a Visual C++ library function equivalent to
_memavl() (as it was in MSC), to obtain the amount of memory
remaining available to malloc() in a Win32 console application?
In addition to other replies. I googled up `_memavl' and can see
that it belongs mostly to real time/embedded OS'es. Windows is
quite different with respect to memory management. There is simply
no such concept as determined available memory. Each process got
4GB od address space, 2GB for kernel mode code and 2GB for user
mode code. So, theoretically you have 2GB available. In practice
you have several system DLL's loaded in the user mode 2GB and
certain memory fragmentation over the lifetime of a process.
However, you can allocate about 1.5-1.7 GB total most of the time.
Some of this memory will be paged out, some of it will be mapped
to physical memory chips. The exact proportion depends on zillion
factors that system memory manager takes into account.
HTH
Alex