On 9/15/06, Hiroki Tamakoshi <[EMAIL PROTECTED]> wrote:
> On Fri, 15 Sep 2006 10:57:31 +0200
> "Markus Gritsch" <[EMAIL PROTECTED]> wrote:
>
> > del obj_list[:] in your example code is definitely not what you want.
> > By [:] you create a copy of your list, and the statement you wrote
> > deletes just this copy.
> >
> > In the following example obj_list is still there.
> > obj_list = []
> > del obj_list[:]
> > print obj_list
> >
> > You definitely want to
> > del obj_list
>
> "del obj_list" deletes obj_list itself and the containing objects.
> But, the memory usage doesn't seem to be free.

Because you cannot explicitely delete an object.  By calling del on a
variable which holds a reference to it, you just remove this
particular reference to the object.  If it was the last reference
pointing to the object, the garbage collector can decide to free the
actual memory *at some time*.  You can tell the garbage collector to
collect all objects which are no longer referenced by calling
  gc.collect()

> Is it realy that del [:] doesn't delete the original objects?
> Even if I rewrite the code as follows, the memory is not freed.
>
> for obj in obj_list:
>         del obj
> del obj_list

see above

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to