[foreign-jextract] Closing sliced segment closes original segment

Filip Krakowski krakowski at hhu.de
Tue Aug 4 13:06:42 UTC 2020


Hi,

I had a couple of IllegalStateExceptions stating that the segment I 
tried to close was already closed. After some debugging I found out this 
is caused by using a try-with-resources statement in combination with a 
MemorySegment (slice) returned by a field access ( try(var slice = 
struct.field$addr(originalsegment) { ... } ). After the statement the 
slice gets closed which also happens to close the original 
MemorySegment. I find this very confusing and would like to ask if this 
is intended behaviour or a bug.

Best regards,
Filip
Email Signature


More information about the panama-dev mailing list