Question on recommended practice with FMA
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Apr 14 10:49:49 UTC 2021
On 14/04/2021 01:16, Remi Forax wrote:
> ----- Mail original -----
>> De: "leerho" <leerho at gmail.com>
>> À: "panama-dev at openjdk.java.net'" <panama-dev at openjdk.java.net>
>> Envoyé: Mercredi 14 Avril 2021 01:37:03
>> Objet: Question on recommended practice with FMA
>> The creation of a slice of a given segment creates a memory leak warning by
>> the Eclipse IDE.
>> (I don't know if IntelliJ does this :) )
>>
>> public void foo(MemorySegment seg) {
>>
>> MemorySegment part = seg.asSlice(offset, size); //Marked as memory
>>> leak
>> ...
>>
>> }
>>
>>
>> When this should not be a resource leak because a slice is only a view on
>> the given segment (assuming this is not a handoff).
>>
>> My choices seem to be
>>
>> - annotate the method with @SuppressWarnings("resource") //ugly
>> - disable resource warnings in the IDE //not a good idea
>> - tolerate warning flags in my code //ugly and not a good idea
>>
>> Any suggestions?
> report this as a bug to bugs.eclipse.org ?
Agree - this seems odd. I'm not super sure as to why that check was
added to memory segment calls and what it does precisely (Eclipse uses a
different compiler for generating this warnings than javac, which is the
compiler that comes with OpenJDK).
Maurizio
>
>> Lee.
> Rémi
More information about the panama-dev
mailing list