Re: freeing memory of ctypes python variables

LukenShiro <[email protected]> Mon, 10 Jan 2011 22:52:35 +0100
Newsgroups gmane.comp.python.ctypes
Message-ID <[email protected]>
Il giorno Mon, 10 Jan 2011 17:31:13 -0200
Patricio Stegmann <[email protected]> ha scritto:
> I am looking for a way to free the memory of some variables on a
> ctypes wrapper I have. I saw that if the code is using python
> variables, the python's gc should free the memory. So for example if
> I create a buffer (via ctypes.create_string_buffer(100*1024*1024))
> and return from that function, python will free automagically that
> memory.
[..]
> However if I create a pointer to that buffer, ctypes or python is not
> freeing the memory even after returning from the function.

If I'm not mistaken, I guess removing with 'del' the related
variable(s), whose allocated memory you want to free, should speed the
garbage collector process. If it is kept referenced I doubt it will be
ever freed. :)


-- 
GNU/Linux * Slackware64 current
LU #210970 SU #12583 LM #98222/#412913


------------------------------------------------------------------------------
Accelerate I/O Performance of HDD-Based Arrays
Configure SSDs as a secondary tier of high performance
cache to maximize transactional I/O performance while
minimizing investments in SSD technology.
http://p.sf.net/sfu/infohub-sdnews