memory - Who takes care of freeing MIB_TCPROW_OWNER_PID structure when calling GetExtendedTcpTable via ctypes in Python? -
i'm calling getextendedtcptable via ctypes in python.
for i'm declaring following structures:
class mib_tcprow_owner_pid(ctypes.structure): _fields_ = [('dwstate', dword), ('dwlocaladdr', dword), ('dwlocalport', dword), ('dwremoteaddr', dword), ('dwremoteport', dword), ('dwowningpid', dword)]
and:
class mib_tcptable_owner_pid(ctypes.structure): _fields_ = [('dwnumentries', dword), ('table', mib_tcprow_owner_pid * any_size)]
where any_size initialized via first call getextendedtcptable.
my question takes care of deallocating memory taken 'table' field above? array of mib_tcprow_owner_pid structures.
or maybe question should be: allocates mib_tcprow_owner_pid structures in array? getextendedtcptable or python?
thanks in advance!
you have allocate sufficient space in table
before calling getextendedtcptable
. , when call returns need deallocate it, although ctypes
you.
if have obtained any_size
calling getextendedtcptable
ptcptable
null
have nothing special do. create instance of mib_tcptable_owner_pid
, sufficient buffer created you.
Comments
Post a Comment