Question on recommended practice with FMA

Remi Forax forax at univ-mlv.fr
Wed Apr 14 00:16:35 UTC 2021


----- 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 ?

> 
> Lee.

Rémi


More information about the panama-dev mailing list