Tuesday 8 January 2008

Memory allocation check???

Q. How can I determine how much memory my application can allocate without severely impacting other applications?

A. you could use GlobalMemoryStatus for this.

usage:
MEMORYSTATUS gMemStatus;
GlobalMemoryStatus(&gMemStatus);

if (gMemStatus.dwMemoryLoad < somevalue)
{
//do.... LocalAlloc
} else
{
//do not allocate anything u want.,........like free memory close other apps and try again...
}

No comments: