def windows_memory_usage():
 from ctypes import windll, Structure, c_uint64, sizeof, byref
 from ctypes.wintypes import DWORD
 class MemoryStatus(Structure, ):
  _fields_ = [('dwLength', DWORD), ('dwMemoryLoad', DWORD), ('ullTotalPhys', c_uint64), ('ullAvailPhys', c_uint64), ('ullTotalPageFile', c_uint64), ('ullAvailPageFile', c_uint64), ('ullTotalVirtual', c_uint64), ('ullAvailVirtual', c_uint64), ('ullAvailExtendedVirtual', c_uint64)]
 memorystatus = MemoryStatus()
 memorystatus.dwLength = sizeof(memorystatus)
 windll.kernel32.GlobalMemoryStatusEx(byref(memorystatus))
 return float(memorystatus.dwMemoryLoad)

def windows_memory_usage ( ) : from ctypes import windll , Structure , c_uint64 , sizeof , byref from ctypes . wintypes import DWORD class MemoryStatus ( Structure , ) : _fields_ = [ ( 'dwLength' , DWORD ) , ( 'dwMemoryLoad' , DWORD ) , ( 'ullTotalPhys' , c_uint64 ) , ( 'ullAvailPhys' , c_uint64 ) , ( 'ullTotalPageFile' , c_uint64 ) , ( 'ullAvailPageFile' , c_uint64 ) , ( 'ullTotalVirtual' , c_uint64 ) , ( 'ullAvailVirtual' , c_uint64 ) , ( 'ullAvailExtendedVirtual' , c_uint64 ) ] memorystatus = MemoryStatus ( ) memorystatus . dwLength = sizeof ( memorystatus ) windll . kernel32 . GlobalMemoryStatusEx ( byref ( memorystatus ) ) return float ( memorystatus . dwMemoryLoad )
return physical memory usage works on windows platforms only .