Hi,

I'm a bit reluctant about finalizers as it is all too easy to introduce subtle problems causing instance to be resurrected. IMO a better approach would be to use phantom references, avoiding such problems.

Michael


On 27.8.15 2:48 , Robert Munteanu wrote:
Hi,

The oak test suite often fails for me due to a large number of running
threads. These are caused by NodeStore instances which are opened but
not disposed. My suggestion would be to override the finalize method
and log a warning when a NodeStore instance is GCed but not disposed,
which is most likely a programming error.

Since the usual scenario ( outside of testing ) is to have 1 or ( maybe
) just a few NodeStore instances per repository, the impact on memory
should be minimal. For the record, with a patched DocumentNodeStore I
get  56 unclosed repository instances in oak-core.

If this is agreeable to everyone I'll create a Jira issue and submit a
patch.

Cheers,

Robert



Reply via email to