Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

memory usage function in BCB6?

Status
Not open for further replies.

markus3000

Programmer
Aug 24, 2010
9
0
0
I want to write unit tests for a BCB6 app that also cycle through each unit to test for memory leaks..
to do this I need a function that can return the memory used by the process at the time of calling.

Is there such a function?
thanks
 
There are some Windows APIs like GlobalSystemStatus and MEMORYSTATUS. If you installed BCB6's help files, you can access their help through "MS SDK Help Files" in Start->Programs->Borland C++ 6->Help->MS SDK Help Files.

James P. Cottingham
[sup]I'm number 1,229!
I'm number 1,229![/sup]
 
thanks, that works great:

LPMEMORYSTATUS lpBuffer = new MEMORYSTATUS;
lpBuffer->dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(lpBuffer); // pointer to the memory status structure
cout<<lpBuffer->dwLength<<"\n";
cout<<lpBuffer->dwMemoryLoad<<"\n";
cout<<lpBuffer->dwTotalPhys<<"\n";
cout<<lpBuffer->dwAvailPhys<<"\n";
cout<<lpBuffer->dwTotalPageFile<<"\n";
cout<<lpBuffer->dwAvailPageFile<<"\n";
cout<<lpBuffer->dwTotalVirtual<<"\n";
cout<<lpBuffer->dwAvailVirtual<<"\n";
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top