MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / physical_free_windows

Function physical_free_windows

bleachbit/Memory.py:221–246  ·  view source on GitHub ↗

Return physical free memory on Windows

()

Source from the content-addressed store, hash-verified

219
220
221def physical_free_windows():
222 """Return physical free memory on Windows"""
223
224 from ctypes import c_ulong, c_ulonglong, Structure, sizeof, windll, byref
225
226 class MEMORYSTATUSEX(Structure):
227 _fields_ = [
228 ('dwLength', c_ulong),
229 ('dwMemoryLoad', c_ulong),
230 ('ullTotalPhys', c_ulonglong),
231 ('ullAvailPhys', c_ulonglong),
232 ('ullTotalPageFile', c_ulonglong),
233 ('ullAvailPageFile', c_ulonglong),
234 ('ullTotalVirtual', c_ulonglong),
235 ('ullAvailVirtual', c_ulonglong),
236 ('ullExtendedVirtual', c_ulonglong),
237 ]
238
239 def GlobalMemoryStatusEx():
240 x = MEMORYSTATUSEX()
241 x.dwLength = sizeof(x)
242 windll.kernel32.GlobalMemoryStatusEx(byref(x))
243 return x
244
245 z = GlobalMemoryStatusEx()
246 return z.ullAvailPhys
247
248
249def physical_free():

Callers 1

physical_freeFunction · 0.85

Calls 1

GlobalMemoryStatusExFunction · 0.85

Tested by

no test coverage detected