Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8257906: JFR: RecordingStream leaks memory #1774

wants to merge 4 commits into from


Copy link

@egahlin egahlin commented Dec 15, 2020


This fix takes care of two memory-leaks that happen when using the RecordingStream in its default configuration.

The first leak happens due to a cache being filled up, but not reset after a chunk segment has been parsed. The second leak is more subtle and happens because objects are created on the heap to track an increased number of chunk files in the disk repository.

Testing: jdk/jdk/jfr

Emitted and parsed about 3 000 chunks and checked the heap usage after GC. A slight increase (10 kb) could be seen over time, resulting in on average 1-2 bytes per million events, but could be due to compressed integers using more space in byte arrays during loading. More time could be spent investigating this, but I like to get these fixes in as soon as possible.

Heap histogram is stable for the important data structures.



  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed




$ git fetch pull/1774/head:pull/1774
$ git checkout pull/1774

Copy link

@bridgekeeper bridgekeeper bot commented Dec 15, 2020

👋 Welcome back egahlin! 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.

Copy link

@openjdk openjdk bot commented Dec 15, 2020

@egahlin The following label will be automatically applied to this pull request:

  • hotspot-jfr

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

@openjdk openjdk bot added the hotspot-jfr label Dec 15, 2020
@egahlin egahlin marked this pull request as ready for review Dec 15, 2020
@openjdk openjdk bot added the rfr label Dec 15, 2020
Copy link

@mlbridge mlbridge bot commented Dec 15, 2020


Copy link

@openjdk openjdk bot commented Dec 15, 2020

@egahlin This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file for details.

After integration, the commit message for the final commit will be:

8257906: JFR: RecordingStream leaks memory

Reviewed-by: mgronlun

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 83 new commits pushed to the master branch:

  • da2415f: 8257457: Update --release 16 symbol information for JDK 16 build 28
  • 36e2097: 8255917: runtime/cds/ failed "assert(reserved_rgn != 0LL) failed: No reserved region"
  • d53ee62: 8255899: Allow uninstallation of jpackage exe bundles
  • 65756ab: 8257802: LogCompilation throws couldn't find bytecode on JDK 8 log
  • a372be4: 8258244: Shenandoah: Not expecting forwarded object in roots during mark after JDK-8240868
  • 568dc29: 8185734: [Windows] Structured Exception Catcher missing around gtest execution
  • 3ab1dfe: 8257828: SafeFetch may crash if invoked in non-JavaThreads
  • 381021a: Merge
  • afc4441: 8258094: AIX build fails after 8257602
  • 164c8a6: 8258092: Link to early access platform documentation in
  • ... and 73 more:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Dec 15, 2020
Copy link
Member Author

@egahlin egahlin commented Dec 16, 2020


@openjdk openjdk bot closed this Dec 16, 2020
@openjdk openjdk bot added integrated and removed ready rfr labels Dec 16, 2020
Copy link

@openjdk openjdk bot commented Dec 16, 2020

@egahlin Since your change was applied there have been 93 commits pushed to the master branch:

  • 0c8cc2c: 8258058: improve description of OutOfMemoryError relevant flags
  • cdb5342: 8258252: Move PtrQueue enqueue to PtrQueueSet subclasses
  • 17ace83: 8258074: Move some flags related to compiler to compiler_globals.hpp
  • 47ba652: 8258455: problem list tools/jdeprscan/tests/jdk/jdeprscan/
  • 1e77896: 8236225: Remove expired flags in JDK 17
  • 4d6f318: 8257726: Make -XX:+StressLdcRewrite option a diagnostic option
  • 8bf46c7: 8258438: build error in test/hotspot/gtest/runtime/test_os.cpp
  • 7977e38: 8254024: Enhance native libs for AWT and Swing to work with GraalVM Native Image
  • c37eabe: 8252148: vmError::controlled_crash should be #ifdef ASSERT and move tests to gtest
  • 2273f95: 8234930: Use MAP_JIT when allocating pages for code cache on macOS
  • ... and 83 more:

Your commit was automatically rebased without conflicts.

Pushed as commit 3c66485.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Copy link
Member Author

@egahlin egahlin commented Jan 4, 2021

/backport jdk16

Copy link

@openjdk openjdk bot commented Jan 4, 2021

@egahlin Unknown command backport - for a list of valid commands use /help.

Copy link
Member Author

@egahlin egahlin commented Jan 4, 2021


Copy link

@openjdk openjdk bot commented Jan 4, 2021

@egahlin Available commands:

  • covered - used when employer has signed the OCA
  • help - shows this text
  • signed - used after signing the OCA
  • test - used to run tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
hotspot-jfr integrated
2 participants