RFR: 8365165: Zap C-heap memory at delete/free

Kim Barrett kbarrett at openjdk.org
Sun Aug 17 12:49:11 UTC 2025


On Fri, 15 Aug 2025 15:03:45 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Okay, I see. So it's the other way around, we zap newly allocated memory, but not free memory. I thought you were doing that, according to your comment:
>> 
>>> When NMT is enabled (which it is for debug builds), we can also do this for frees, as NMT tells us the size of the free-ed block.
>
> The PR does *all three*, take a look? Current code already zaps on malloc/realloc path, those paths are now under new `ZapCHeap` flag. New code zaps on free path, and it is also under new `ZapCHeap` flag. So in the end, `ZapCHeap` covers malloc/realloc/free, and thus it has a proper name.

@shipilev Thanks for doing some performance testing. Yeah, that doesn't look too bad.

Change looks good.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26775#discussion_r2280866507


More information about the hotspot-runtime-dev mailing list