[pylucene-dev] finalizing the deadly embrace

Andi Vajda vajda at osafoundation.org
Mon Jan 21 11:19:01 PST 2008


On Mon, 21 Jan 2008, anurag uniyal wrote:

> This still fails *here* after removing __del__

> I did rebuild JCC thats why now custom analyzer/parser works without 
> finalize.
> test_PythonDirectory.py is also passing.

When run with -loop ?

> src : trunk rev 381
> lucene.VERSION = 2.2.0-613493
> Python 2.4.3
> Ubuntu 6.06.1 LTS
> java 1.5.0_06-b05

Ok, I have such a system available to me, I'm going to give your test a try 
there.

Still, could you in the meantime try to find out what is leaking ?
If Java is running out of memory, one way to track down what is causing it 
is to look at the global refs PyLucene keeps to Java objects.

First, after each test cycle, print out the size of env._dumpRefs().
env is the return value from initVM()

   print len(env._dumpRefs)

if that size is growing, next thing is to get the classes of these objects:

   refs = sorted(env._dumpRefs(classes=True).items(),
                 key=lambda x: x[1], reverse=True)
   print refs[0:4]

This would print out the classes of the 5 most important Java object leaks 
via global refs and their counts. (the code above is used in 
test/test_Sort.py, for example).

Andi..


More information about the pylucene-dev mailing list