[pylucene-dev] bug report: memory leak

Yura Smolsky info at altervision.biz
Mon Mar 14 05:08:24 PST 2005


Hello, pylucene-dev.

I have discovered memory leak. When I use ParallelMultiSearcher then
memory usage is okay.
But when I try to use object of this class under PyLucene.PythonThread
then I receive memory leaks.
Actually size of leak is not big, but when application run for hours
then memory usage is very noticable.

After start:
$ ps aux
500      18732 85.0 13.2 328624 270900 pts/1 S    07:00   0:03 /usr/bin/python2.4 ./RemoteSearchThread.py

After 10 minutes:
$ ps aux
500      18732 94.6 14.9 357556 306592 pts/1 S    07:00   2:08 /usr/bin/python2.4 ./RemoteSearchThread.py

After 20 minutes:
ps aux
500      18732 87.5 16.3 378804 334784 pts/1 S    07:00   4:47 /usr/bin/python2.4 ./RemoteSearchThread.py

It never stops to leaking memory, always consuming.

I have attached example of code to reproduce bug.

Yura Smolsky.
-------------- next part --------------
#!/usr/bin/python2.4

from PyLucene import *
from IndexerLucene import *
import threading

class MyThread(PythonThread):
    def __init__(self, searcher):
	
	self.searcher = searcher
	PythonThread.__init__(self)
	
    def run(self):
	a = StandardAnalyzer()
	query = QueryParser.parse("bad", "content", a)
	hits = searcher.search(query)
	del self.searcher
	
	
searcher = IndexSearcher("index/index03")

parallel = ParallelMultiSearcher([searcher])

for i in range(10000000):
    th = MyThread(parallel)
    th.start()
    th.join()



More information about the pylucene-dev mailing list