[Matrix-SIG] Freeing malloc'd array in Python

Scott M. Ransom ransom@cfa.harvard.edu
Sat, 05 Sep 1998 21:08:21 +0000


Aaron Watters wrote:

> ...maybe try this instead
>
> a = my_range(10000)
> a = None
> 1
>
> Now the object should be gone.

The object is gone, but the data memory is still allocated.

>  Another thing that can
> happen is the object can get stuck on a traceback object
>
> import sys
> sys.last_traceback = None

This didn't help either.

> If you really have a memory leak this should cause problems
>
> from time import sleep
> for i in range(100):
>      x = my_range(10000)
>      print "sleeping"; sleep(2)
>
> ...watch the process size from another window.  If it really
> is leaking, maybe recomplain.   -- Aaron Watters

OK.  I'm recomplaining.  It is leaking like a seive....

Any other ideas?

Is there an easy way to free a malloc'd array from Python?

--
Scott M. Ransom
Phone:  (580) 536-7215             Address:  703 SW Chaucer Cir.
email:  ransom@cfa.harvard.edu               Lawton, OK  73505
PGP Fingerprint: D2 0E D0 10 CD 95 06 DA  EF 78 FE 2B CB 3A D3 53