Re: freeing the memory of a casted object ? Solution found !
"Diez B. Roggisch" <[email protected]> Fri, 24 Jun 2011 11:14:38 +0200
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <[email protected]> |
On Jun 24, 2011, at 1:00 AM, Patricio Stegmann wrote: > Thank you all for the interest in my pain :) > > I managed, after googling and ircing a bit, a quick solution for this problem. Basically I manually free the memory with the platform's free function. > This, on my WinXP box, is present on MsVcrt libs. In practice, this worked very well: That's the worst solution. You are bound to get segfaults if python eventually tries to get rid of the allocated objects itself - and will cause a double free. If you can't get the problem solved differently, the least thing you should do is to allocate the memory with malloc yourself - then it's fully up to you to release it. > > Now I wonder if there is a way to find out which memory is unused and free it "automagically". Do someone know of a way to check memory allocation for everything derivated from a python script ? It's called garbage collection, and that's what Python is supposed to do. Why don't you just use the gc.collect()-call Andrew McIntyre & I suggested? Diez ------------------------------------------------------------------------------ All the data continuously generated in your IT infrastructure contains a definitive record of customers, application performance, security threats, fraudulent activity and more. Splunk takes this data and makes sense of it. Business sense. IT sense. Common sense.. http://p.sf.net/sfu/splunk-d2d-c1 _______________________________________________ ctypes-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ctypes-users