On Friday 15 September 2006 12:41, Hiroki Tamakoshi wrote:
> On Fri, 15 Sep 2006 11:30:11 +0200
> 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.

If you want to see if you have memory leaks try to run your code in an 
infinite loop:

while 1:
    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

and monitor memory usage. If it only increases once while the first pool 
of 1000 objects is created, but then stays constant you are fine. I means 
that the memory is not returned to the OS but reused for the next bunch 
of 1000 objects and so on. If it constantly grows you have a mem leak.

-- 
Dan

-------------------------------------------------------------------------
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