garbage colllector

A

Alberto Vera

Hello:
I'd like to try the use of garbage collector, so I wrote these lines to do it(*), but if I delete lines related to garbage collector this works similar as it didn't have

Do you know another way to try the use of garbage collector?

Thanks

(*)
import gc

gw_was_enabled= gc.isenabled()
if gw_was_enabled:
gc.collect()
else:
gc.enable()

t=0
while 1<2:

gc.collect()
MyDict2 = {}
MyDict2['x']="122222222222222222222222222.3333333333333333333333333333"
MyDict2['Y']="2.24233333333333333333333333333333333332"

t+=1

localtime = time.localtime()
print str(t)+" "+str(time.strftime('%Y-%m-%d %H:%M:%S', localtime))
 
J

Jeremy Fincher

Alberto Vera said:
Hello:
I'd like to try the use of garbage collector, so I wrote these lines to
do it(*), but if I delete lines related to garbage collector this works
similar as it didn't have
<snip>

The garbage collector is enabled by default. You'll very rarely have
a good reason to manipulate it.

Jeremy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,462
Latest member
ChanaLipsc

Latest Threads

Top