geoff wrote:
> Any tips/hints on calculating the potentially available space ?
>
Do you mean the total amount of process virtual memory space still
available? You can actually get that from the GlobalMemoryStatusEx
API. There's no Python wrapper for that, as far as I know, but here's a
ctypes wrapper. Note that this does not return the total CONTIGUOUS
memory space, but for your purposes, that's probably not critical.
from ctypes import *
from ctypes.wintypes import *
class MEMORYSTATUSEX(Structure):
_fields_ = [
('dwLength', DWORD),
('dwMemoryLoad', DWORD),
('ullTotalPhys', c_ulonglong),
('ullAvailPhys', c_ulonglong),
('ullTotalPageFile', c_ulonglong),
('ullAvailPageFile', c_ulonglong),
('ullTotalVirtual', c_ulonglong),
('ullAvailVirtual', c_ulonglong),
('ullExtendedVirtual', c_ulonglong),
]
def GlobalMemoryStatusEx():
x = MEMORYSTATUSEX()
x.dwLength = sizeof(x)
windll.kernel32.GlobalMemoryStatusEx(byref(x))
return x
z = GlobalMemoryStatusEx()
print z.ullAvailVirtual
--
Tim Roberts, [email protected]
Providenza & Boekelheide, Inc.
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32