Re: [ctypes-users] releasing a ctypes POINTER(ctypes.c_double
* 800)
by Ray Schumacher other posts by this author
Feb 26 2004 12:53AM messages near this date
RE: [ctypes-users] com change
|
Re: [ctypes-users] ctypes memory considerations?
Hi all,
From Thomas Heller:
> Yes, something like this. You should simply call
> cdll.msvcrt.free(obj)
> where obj is the result of your call to the C function.
> It should be clear that you cannot access 'obj' anymore after that.
I've been trying some variations on this, but getting errors.
I tried del() on the objects and pointers with no effect.
I have also tried gc.collect(), with no effect.
## init the object to receive the data
retobj = ctypes.c_double * 800
retP = ctypes.POINTER(retobj)
## define the instance's return resource type
self.peakLoad.peak_load.restype = retP
## call peak_load and get a pointer to the return
retPointer = self.peakLoad.peak_load(timeDomData1, FFTPeakHistory1)
If I comment out "retPointer = ..." memory increases at data rate, ~10KB/s, as expected. But
, since this is in a tight loop, when uncommented it grabs 1.1MB/s (~180 loops/s ).
Thanks for your input,
Ray
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
ctypes-users mailing list
ctypes-users@[...].net
https://lists.sourceforge.net/lists/listinfo/ctypes-users
|