# Revision history [back]

Well, it turns out that there is "nothing wrong" except that the garbage collector is not our friend on that one... The code is ok but some objects are not freed from the memory even when they are not useful anymore, and the developpers on sage-devel advised to call the following code :

import gc
gc.collect()


They also seemed to say that calling gc.collect() was a time-consuming operation, so I guess that in your situation the best option is ti call gc.collect() every 1000th run.

Something like that :

if count % 5000 == 0:
gc.collect()


I do not like it, but it looks like it is the best situation available :-)

Nathann