Question on recommended practice with FMA

leerho leerho at gmail.com
Tue Apr 13 23:37:03 UTC 2021


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?

Lee.


More information about the panama-dev mailing list