RFR: 8277930: Add unsafe allocation event to jfr [v5]

xpbob duke at openjdk.java.net
Fri Dec 3 12:37:17 UTC 2021


On Tue, 30 Nov 2021 11:04:44 GMT, xpbob <duke at openjdk.java.net> wrote:

>> Unsafe is used in many Java frameworks.
>> When the framework has a unsafe memory leak , there is no way to know what code is causing it.
>> Add unsafe allocation event to jfr.
>> Records the size and stack allocated.
>> This event is off by default
>
> xpbob has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains five additional commits since the last revision:
> 
>  - Merge branch 'openjdk:master' into JDK-8277930
>  - remove whitespace
>  - add free and Reallocate event
>  - Merge branch 'openjdk:master' into JDK-8277930
>  - 8277930: Add unsafe allocation event to jfr

Thanks


I use  http://cr.openjdk.java.net/~jvernee/UnsafeTest.java

The results were about the same with and without the checking


I want to implement the  java event and test it again


env:linux


code without unsafe event
---

c.unsafe.UnsafeTest.mallocAndFree                 8   avgt   20  66.237 ± 0.672   ns/op
c.unsafe.UnsafeTest.mallocAndFree                12   avgt   20  66.596 ± 0.286   ns/op
c.unsafe.UnsafeTest.mallocAndFree                16   avgt   20  66.219 ± 0.621   ns/op
c.unsafe.UnsafeTest.mallocAndFree                24   avgt   20  66.715 ± 0.329   ns/op
c.unsafe.UnsafeTest.mallocAndFree                32   avgt   20  65.959 ± 0.714   ns/op
c.unsafe.UnsafeTest.mallocAndFree              4096   avgt   20  71.858 ± 3.306   ns/op

---
code with event commit
----

c.unsafe.UnsafeTest.mallocAndFree                 8   avgt   20  68.402 ± 0.257   ns/op
c.unsafe.UnsafeTest.mallocAndFree                12   avgt   20  68.414 ± 0.276   ns/op
c.unsafe.UnsafeTest.mallocAndFree                16   avgt   20  68.405 ± 0.216   ns/op
c.unsafe.UnsafeTest.mallocAndFree                24   avgt   20  68.427 ± 0.219   ns/op
c.unsafe.UnsafeTest.mallocAndFree                32   avgt   20  68.339 ± 0.207   ns/op
c.unsafe.UnsafeTest.mallocAndFree              4096   avgt   20  74.645 ± 3.285   ns/op

----
code wtih should_commit
---
c.unsafe.UnsafeTest.mallocAndFree                 8   avgt   20  68.342 ± 0.273   ns/op
c.unsafe.UnsafeTest.mallocAndFree                12   avgt   20  68.653 ± 0.359   ns/op
c.unsafe.UnsafeTest.mallocAndFree                16   avgt   20  68.421 ± 0.237   ns/op
c.unsafe.UnsafeTest.mallocAndFree                24   avgt   20  68.496 ± 0.205   ns/op
c.unsafe.UnsafeTest.mallocAndFree                32   avgt   20  68.370 ± 0.238   ns/op
c.unsafe.UnsafeTest.mallocAndFree              4096   avgt   20  75.110 ± 2.866   ns/op

-------------

PR: https://git.openjdk.java.net/jdk/pull/6591


More information about the hotspot-jfr-dev mailing list