Am 11.05.2011 18:14, schrieb Christian Heimes:
> ---
> import lucene
> import threading
> import time
> import gc
>
> lucene.initVM()
>
> def alloc():
> while 1:
> gc.collect()
> time.sleep(0.011)
>
> t = threading.Thread(target=alloc)
> t.daemon = True
>
> t.start()
>
> while 1:
> obj = {}
> # create cycle
> obj["obj"] = obj
> obj["jcc"] = lucene.JArray('object')(1, lucene.File)
> time.sleep(0.001)
>
> ---
The example crashes also with functions like but it takes a bit longer
def alloc():
while 1:
a = {}, {}, {}, {}, {}, {}
time.sleep(0.011)
def alloc():
while 1:
# create 500 bound methods to exceed PyMethod_MAXFREELIST 256
methods = []
for i in xrange(500):
methods.append(str("abc").strip)
time.sleep(0.011)
Christian