RFR: 8301403: Eliminate memory allocations in JVMFlag::printFlags during signal handling [v3]
Thomas Stuefe
stuefe at openjdk.org
Thu Jul 18 10:05:32 UTC 2024
On Thu, 18 Jul 2024 07:33:35 GMT, David Holmes <dholmes at openjdk.org> wrote:
> Not sure how you could avoid a full blown allocator though if you expect to fall-back to malloc if the pool/balloon is empty, as you would need to track what free's relate to the pool/balloon.
Two solutions:
- very very simple: just don't free during error reporting. It may lead to a bit of memory loss, but we should not malloc that much anyway. And arguably its the healthier option since if the libc is corrupted, it is actually more likely to crash or deadlock on free()
- somewhat simple: Assuming the balloon is just a simple memory region, on os::free, if in error reporting, check if pointer points into the balloon. If yes, don't call free(). Costs two pointer comparisons.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20202#issuecomment-2236115761
More information about the hotspot-runtime-dev
mailing list