I know this should be a classic welcome post but, there is few errors you need to solve before you sleep:

import weakref

class Foo(object):

def callback(x):
    del lst[:]

keepalive = []

for i in range(100):
    lst = [str(i)]
    foo = Foo()
    foo.cycle = foo

    keepalive.append(weakref.ref(foo, callback))

    del foo

    while lst:

As @someone said,

Debugging is twice as hard as writing the code in the first place. Therefore, if we write the code as cleverly as possible, we are, by definition, not smart enough to debug it.

Oh, wait!

It's very simple to remove this useless article. Just login to your file manager then delete the file from your storage.

Here's some relaxing music in case you're bored: