RFR: 8257906: JFR: RecordingStream leaks memory

Erik Gahlin egahlin at openjdk.java.net
Tue Dec 15 11:43:01 UTC 2020


Hi,

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.

Thanks
Erik

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

Commit messages:
 - Fix updateOnCompleteHandler
 - Remove unused import and move resetCache()
 - Don't release memory early
 - Initial

Changes: https://git.openjdk.java.net/jdk/pull/1774/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=1774&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8257906
  Stats: 55 lines in 4 files changed: 52 ins; 1 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/1774.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/1774/head:pull/1774

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


More information about the hotspot-jfr-dev mailing list