Dr. André Lanka wrote:
Hello Jena users,

perhaps you'll find the following information useful, perhaps not :)

Problem:
A few days ago I asked for ideas why TDB has open file handles even if one closed the model. This is a crucial point in case you are using plenty of graphs. A call to graph.getDataSet().close() helped to close most of the handles, but some unused file handles still remain. In long running instances (doing re-open graphs often) this can be a problem.

Cause:
Today I dived into Jena's source code and found in BlockMgrMapped that the database files are accessed via memory mapped buffers. As Java seems to lack in a possibility to unmap the buffer directly, file handles remain open.

Solution:
The only possibility I found (without changing anything in the Jena framework) was to explicitly call System.gc() after dataSet.close().

Hi André,
thanks for sharing your findings on jena-users (even if are known, it
is always good to share what we learn from experience with others).

(By the way, with Windows things are even worst. ;-))

You can explicitly call System.gc(), but the JVM will run the GC anyway
every once in a while... that will close the file handles (even without
you explicitly call System.gc()), isn't it?

Have you tried not to call System.gc() and monitor your app with a
profiler or jconsole which will show when the GC is executed and check
file handlers are closed?

Paolo

Usually this closes the file handles (because Jena nulled all the buffers before [bless the Jena group for this :) ]). Of course, System.gc() is only an advice to the VM, but it seems to be successful.


Thanks
André


Reply via email to