RFR: 8284620: CodeBuffer may leak _overflow_arena

Zhengyu Gu zgu at openjdk.java.net
Sat Apr 9 16:07:51 UTC 2022


`CodeBuffer` is declared as `StackObj`, but it also has `ResourceObj` style `new operator`, to complicate thing further more, it has _overflow_arena that is C Heap allocated.

When Stack allocated `CodeBuffer` owns `_overflow_arena`, it works fine, because its destructor frees `_overflow_arena`. But if resource allocated `CodeBuffer` owns `_overflow_arena`, the arena is leaked, because its destructor is never called.

Test:
- [x] hotspot_compiler on Linux x86_64

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

Commit messages:
 - v0

Changes: https://git.openjdk.java.net/jdk/pull/8172/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=8172&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8284620
  Stats: 7 lines in 1 file changed: 3 ins; 3 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/8172.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/8172/head:pull/8172

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


More information about the hotspot-compiler-dev mailing list