Thanks everyone for the discussion. Will take a look at the Mulgara code. 

Simon




From:
Paul Gearon <[email protected]>
To:
[email protected]
Date:
05/18/2012 11:56 AM
Subject:
Re: API changes



On Fri, May 18, 2012 at 2:43 AM, Paolo Castagna
<[email protected]> wrote:
> Hi Paul,
> first of all, thanks for your comments and suggestions.
>
> Paul Gearon wrote:
>> We recently pulled most of this code out and put it into a single file.
>>
>> 
http://mulgara.org/svn/mulgara/trunk/src/jar/util/java/org/mulgara/util/io/MappingUtil.java

>>
>> Hopefully it's clear enough, but ask questions if there's anything too 
obtuse.
>
> The clean(...) method uses sun.misc.Cleaner and MappingUtil.java imports 
it, so I assume this would work on with Sun/Oracle JVMs, am I correct?
> Some of the Jena users (and some of those having problems with memory 
mapped files on Windows) do not use Oracle JVM, so I guess that approach 
would not work for them.
>
> The last comment on http://bugs.sun.com/view_bug.do?bug_id=4724038 
suggests a similar solution: ((sun.nio.ch.DirectBuffer) 
buf).cleaner().clean()
> It would be interesting to know if there are equivalent 
.cleaner().clean() methods in other JVMs, if so, someone might use 
reflection and route the .clean() method to the various internal objects.
>
> Or, are sun.misc.Cleaner and/or sun.nio.ch.DirectBuffer available in 
other JVMs? (I don't know)

The clean() method is advertised as the appropriate mechanism, but as
it's not part of the Sun/Oracle spec there is no need for any other
JVM to include it. I have no idea if anyone does.

The technique of re-running a GC works empirically, though it has a
performance issue, and can't actually be *guaranteed*. In practice, we
found that the probability of an object surviving more than a few
consecutive CGs diminished rapidly, to the point where nothing seems
to get past about 6. Bringing a cleaner into it avoids the need for
consecutive GCs (meaning that the object *can* be guaranteed to be
removed, and avoiding the multiple GC overhead), but since we can't be
guaranteed that cleaners will be available then we keep the option
available.

> Thanks again,
> Paolo
>
> PS:
> I am a Linux users (from many, many years... my last Windows was Windows 
98) so, sorry, but I cannot help testing this.
> I also tend to use Oracle's JVMs on 64-bits Linux OS and JVMs... which 
do not have the problem. ;-)

I moved to Linux in 98, and last worked on Windows in '04. These days
I'm mostly on Mac, and my only access to Windows is through
"Parallels". However, we ran into these issues nearly 10 years ago,
and after many months of debugging and testing (since the bug was
rare, and only on Windows) we found that this approach fixed
everything for us.

Regards,
Paul



Reply via email to