<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">Ok so here are the recordings:<div class=""><br class=""></div><div class="">with duplicate(): <a href="https://static.cryptomator.org/tmp/before890035c.jfr" class="">https://static.cryptomator.org/tmp/before890035c.jfr</a></div><div class="">without: <a href="https://static.cryptomator.org/tmp/after890035c.jfr" class="">https://static.cryptomator.org/tmp/after890035c.jfr</a></div><div class=""><br class=""></div><div class="">This is the diff in code: <a href="https://github.com/cryptomator/jfuse/commit/890035c702489cdb2e094a1fc767e75b15b04891" class="">https://github.com/cryptomator/jfuse/commit/890035c702489cdb2e094a1fc767e75b15b04891</a></div><div class=""><br class=""></div><div class="">I was testing the `read` method in this class. `write` (with its `.asReadOnlyBuffer()`) did not draw my attention.</div><div class=""><div class=""><div class=""><div><br class=""><blockquote type="cite" class=""><div class="">On 25. Oct 2022, at 15:03, Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" class="">maurizio.cimadamore@oracle.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">No worries.<br class=""><br class="">I guess having a look at jfr file would be useful. But note that I don't think you can send that to the mailing list - AFAIK, attachments are dropped.<br class=""><br class="">Also, forgot to ask - is this something for which you saw a difference between 18 and 19? Because that would be odd too.<br class=""><br class="">Maurizio<br class=""><br class="">On 25/10/2022 13:26, Sebastian Stenzel wrote:<br class=""><blockquote type="cite" class="">I can't reproduce it any longer. ðŸ˜–<br class=""><br class="">I swear I would not have consulted the mailing list, if the observation had not been that spooky. Especially regarding said discrepency between `asReadOnlyBuffer()` and `duplicate()`.<br class=""><br class="">I still have the .jfr file, though. Is this of any use (other than proving I'm not seeing ghosts)?<br class=""><br class=""><blockquote type="cite" class="">On 25. Oct 2022, at 13:15, Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" class="">maurizio.cimadamore@oracle.com</a>> wrote:<br class=""><br class=""><br class="">On 25/10/2022 12:04, Maurizio Cimadamore wrote:<br class=""><blockquote type="cite" class="">```<br class="">public MappedByteBuffer duplicate() {<br class="">         return new DirectByteBuffer(this,<br class="">                                               this.markValue(),<br class="">                                               this.position(),<br class="">                                               this.limit(),<br class="">                                               this.capacity(),<br class="">                                               0,<br class=""><br class="">                                               fileDescriptor(),<br class="">                                               isSync(),<br class=""><br class="">                                               segment);<br class="">     }<br class="">```<br class=""></blockquote>Btw, the implementation of `adReadOnlyBuffer` is virtually identical to the above - the only difference is that DirectBuffer::asReadOnlyBuffer creates a new DIrectBufferR (where R stands for Read Only), not just another DirectBuffer. On read-only direct buffers (DirectBufferR), asReadOnly buffer just calls duplicate().<br class=""><br class="">So, I think it's very strange that one one of them misbehave, since the implementation is so close.<br class=""><br class="">What do you use to monitor the allocations? One theory is that perhaps one version of the code "escapes" better than the other, so the numbers you see are skewed, and in some cases you see the actual BB allocations on the heap, whereas in the other case you don't see anything because the JVM scalarizes the BB views. But again, the `duplicate` and `adreadOnlyBuffer` are so close to each other that it's hard to imagine meaningful differences in terms of escape analysis (even though escape analsyis can sometimes act in surprising ways).<br class=""><br class="">Maurizio<br class=""><br class=""></blockquote></blockquote></div></div></blockquote></div><br class=""></div></div></div></body></html>