RFR: 8372373: Make ResolutionErrorEntry's interface less susceptible to memory leaks [v2]
Johan Sjölen
jsjolen at openjdk.org
Sat Nov 22 14:40:41 UTC 2025
> Hi,
>
> Ioi discovered that the `ResolutionErrorEntry`'s two constructors are working in two different ways: One of them copies the string, and the other one requires the string to already be on the CHeap. This leads to code that's difficult to understand and increases the risk of memory leaks. This PR makes the interface more uniform.
>
> I've done a few style changes as well, hope those are OK.
>
> Here's a list of the callsites I found:
>
> constantPool.cpp:992:
> Strings are Resource-allocated and strdupped
> cpCache.cpp:746
> Strings are Resource-allocated and strupped
> instanceKlass.cpp:317
> Was manually CHeap allocated and transferred to REE, now wrapped in stringStream and strdupped
> instanceKlass.cpp:361
> Was manually CHeap allocated and transferred to REE, now wrapped in stringStream and strdupped
> systemDictionary.cpp:1872
> Potential memory leak via set_nest_host_error
Johan Sjölen has updated the pull request incrementally with one additional commit since the last revision:
Some renaming so that you don't misunderstand
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/28466/files
- new: https://git.openjdk.org/jdk/pull/28466/files/ea21ad3e..8dc79c19
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=28466&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=28466&range=00-01
Stats: 14 lines in 2 files changed: 8 ins; 1 del; 5 mod
Patch: https://git.openjdk.org/jdk/pull/28466.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/28466/head:pull/28466
PR: https://git.openjdk.org/jdk/pull/28466
More information about the hotspot-dev
mailing list