Java 9 build 148 causes trouble in Apache Lucene/Solr/Elasticsearch
Peter Levart
peter.levart at gmail.com
Sun Dec 11 18:33:36 UTC 2016
Hi Chris,
On 12/11/2016 10:26 AM, Chris Hegarty wrote:
>> >"Deallocates the underlying memory associated with given directBuffer if the buffer was obtained from either {@link ByteBuffer#allocateDirect} or {@link FileChannel#map} methods. In any other case (when the buffer is not a direct buffer or was obtained by {@link ByteBuffer#duplicate() duplicating} or {@link ByteBuffer#slice(int, int) slicing} a direct buffer), the method throws {@code IllegalArgumentException}.
> Yes, but given a ByteBuffer it is not possible to determine if it “owns” the
> memory, or not. So users of the API would have to have full knowledge of
> the buffers they pass to it. Maybe this is ok?
>
> -Chris.
In order for deallocation to be effective and, above all, safe, user has
to know the whole story of a buffer (s)he intends to deallocate and the
story of all possible derived buffers. I don't believe one can create a
safe program by choosing to deallocate a direct buffer for which (s)he
does not know where it came from, because then (s)he also doesn't know
what other buffers might still be using the same piece of memory.
Regards, Peter
More information about the jigsaw-dev
mailing list