Skip to content

Conversation

@tstuefe
Copy link
Member

@tstuefe tstuefe commented Aug 19, 2025

A frequent scenario I encounter when analyzing native OOM scenarios at customers is that third-party libraries use Unsafe.allocateMemory to allocate chunks of native memory. Netty is one such example.

Typically, we can ascertain with NMT that yes, someone calls Unsafe.allocateMemory. But from then on, we fly blind. We have to guess since we don't have stack traces. Folks then start using tools like hooking in a different libc implementation (e.g. jemalloc) or asyncprofiler to continue analysis. Using tools may not be possible in production scenarios.

It would therefore be nice to have a JFR event for these events to enable this analysis with JFR.

There is one minor issue, though, that since this event is externally triggered, we cannot predict its frequency. Therefore, such an event should be throttleable and throttled by default.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Integration blocker

 ⚠️ Title mismatch between PR and JBS for issue JDK-8365729

Issue

  • JDK-8365729: JFR: Unsafe::allocateMemory event (Enhancement - P4) ⚠️ Title mismatch between PR and JBS.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/26834/head:pull/26834
$ git checkout pull/26834

Update a local copy of the PR:
$ git checkout pull/26834
$ git pull https://git.openjdk.org/jdk.git pull/26834/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 26834

View PR using the GUI difftool:
$ git pr show -t 26834

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/26834.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Aug 19, 2025

👋 Welcome back stuefe! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Aug 19, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented Aug 19, 2025

@tstuefe The following labels will be automatically applied to this pull request:

  • core-libs
  • hotspot

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing lists. If you would like to change these labels, use the /label pull request command.

@tstuefe
Copy link
Member Author

tstuefe commented Aug 19, 2025

/label remove core-libs
/label add jfr-dev

@tstuefe
Copy link
Member Author

tstuefe commented Aug 19, 2025

/label remove hotspot
/label add hotspot-runtime

@openjdk
Copy link

openjdk bot commented Aug 19, 2025

@tstuefe
The core-libs label was successfully removed.

@openjdk
Copy link

openjdk bot commented Aug 19, 2025

@tstuefe
The label jfr is not a valid label.
These labels are valid:

  • graal
  • serviceability
  • hotspot
  • hotspot-compiler
  • ide-support
  • i18n
  • shenandoah
  • jdk
  • javadoc
  • security
  • hotspot-runtime
  • jmx
  • build
  • nio
  • client
  • core-libs
  • compiler
  • net
  • hotspot-gc
  • hotspot-jfr

@openjdk
Copy link

openjdk bot commented Aug 19, 2025

@tstuefe
The hotspot label was successfully removed.

@openjdk
Copy link

openjdk bot commented Aug 19, 2025

@tstuefe
The hotspot-runtime label was successfully added.

@openjdk
Copy link

openjdk bot commented Aug 26, 2025

@tstuefe this pull request can not be integrated into master due to one or more merge conflicts. To resolve these merge conflicts and update this pull request you can run the following commands in the local repository for your personal fork:

git checkout JFR-Unsafe.allocateMemory
git fetch https://git.openjdk.org/jdk.git master
git merge FETCH_HEAD
# resolve conflicts and follow the instructions given by git merge
git commit -m "Merge master"
git push

@openjdk openjdk bot added the merge-conflict Pull request has merge conflict with target branch label Aug 26, 2025
@tstuefe
Copy link
Member Author

tstuefe commented Sep 25, 2025

/keepalive

@openjdk
Copy link

openjdk bot commented Sep 25, 2025

@tstuefe The pull request is being re-evaluated and the inactivity timeout has been reset.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotspot-runtime [email protected] merge-conflict Pull request has merge conflict with target branch

Development

Successfully merging this pull request may close these issues.

1 participant