On 9/15/06, Markus Gritsch <[EMAIL PROTECTED]> wrote:
> On 9/15/06, Hiroki Tamakoshi <[EMAIL PROTECTED]> wrote:
> >
> > On Fri, 15 Sep 2006 11:30:11 +0200
> > "Markus Gritsch" <[EMAIL PROTECTED]> wrote:
> >
> > > 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()
> >
> > calling gc.collect() doesn't change the memory usage.
> > (Dan's patch is applied)
> >
> > obj_list = []
> > for i in xrange( 1000 ):
> >         obj = SomeObject( parameters ... )
> >         obj_list.append( obj ) # memory grows
> >
> > for obj in obj_list:
> >         obj.expire() # clear cache
> >
> > del obj_list
> > gc.collect() # <- added here, memory usage doesn't change.
>
> What if you omit expiring every single object and do a
>
> sqlhub.processConnection.cache.clear()
>
> instead?

Something like

obj_list = []
for i in range( 1000 ):
        obj = SomeObject( parameters ... )
        obj_list.append( obj ) # memory grows

del obj_list
sqlhub.processConnection.cache.clear()

gc.collect() # maybe skip this -- I never explicitly force the gc to collect.

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to