How much system ram is present?

BlitzMax Forums/BlitzMax Beginners Area/How much system ram is present?

Shagwana(Posted 2005) [#1]
Now how would one go about finding out such a thing (total & free!)?.


N(Posted 2005) [#2]
Nice of you to disappear on IRC whenever I try to help you.

Strict

Extern "Win32"
	Function GlobalMemoryStatus( buffer:Byte Ptr )
End Extern

'' Memory structure containing the amounts of memory available IN BYTES
'' For some reaosn or other, the page file size is reported as negative on my PC
'' So if you (for some inane reason) want the size of the page file, you may have
'' to do some digging to find out what's up
Type MEMORYSTATUS Final
Rem
  DWORD dwLength;
  DWORD dwMemoryLoad;
  SIZE_T dwTotalPhys;
  SIZE_T dwAvailPhys;
  SIZE_T dwTotalPageFile;
  SIZE_T dwAvailPageFile;
  SIZE_T dwTotalVirtual;
  SIZE_T dwAvailVirtual;
End Rem
	Field dwLength
	Field dwMemoryLoad
	Field dwTotalPhys
	Field dwAvailPhys
	Field dwTotalPageFile
	Field dwAvailPageFile
	Field dwTotalVirtual
	Field dwAvailVirtual
	
	Method New( )
		GlobalMemoryStatus( Varptr Self.dwLength )
		If Self.dwLength <> 32 Then Throw "MEMORYSTATUS.dwLength <> 32"
	End Method
End Type


'' TEST CODE
Local i:MEMORYSTATUS = New MEMORYSTATUS
Print "Structure Size: "+i.dwLength
Print "Memory Load: "+i.dwMemoryLoad+"b"
Print "Total Physical: "+i.dwTotalPhys+"b"
Print "Available Physical: "+i.dwAvailPhys+"b"
Print "Total Page File: "+i.dwTotalPageFile+"b"
Print "Available Page File: "+i.dwAvailPageFile+"b"
Print "Total Virtual: "+i.dwTotalVirtual+"b"
Print "Available Virtual: "+i.dwAvailVirtual+"b"
Input



Shagwana(Posted 2005) [#3]
Thank you.

Now just for completness, anyone got a mac version?!


(tu) ENAY(Posted 2005) [#4]
Does system ram in Blitzmax include loaded audio?