From: Markus G. <m.g...@gm...> - 2006-09-15 08:57:34
|
On 9/15/06, Hiroki Tamakoshi <hir...@be...> wrote: > Thanks Dan, > > Can I consult with you even if the problem I have is not the problem of > circular references? > > The expected work is clear, and natural I think: > 1. A sqlobject is persistent in RDBMS, > 2. and when I want to delete the object, it is freed from memory(and > cache), but its data is still persistent in RDBMS. > > Here is a sample code: > > 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[:] > # expected work: clear memory, but data remain in RDBMS. > # actual work: memory doesn't seem to be cleared, data remain in RDBMS. 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 |