8337994: [REDO] Native memory leak when not recording any events

Reviewed-by: egahlin
This commit is contained in:
Markus Grönlund 2024-08-08 14:38:46 +00:00
parent 4b740d87ee
commit 6a9a867d64
2 changed files with 10 additions and 5 deletions

View File

@ -883,6 +883,15 @@ static void do_clds(CldWriter& cldw) {
ModuleCldWriter mcw(&cldw);
KlassAndModuleCldWriter kmcw(&kcw, &mcw);
_artifacts->iterate_klasses(kmcw);
if (is_initial_typeset_for_chunk()) {
CldPtr bootloader = get_cld(Universe::boolArrayKlass());
assert(bootloader != nullptr, "invariant");
if (IS_NOT_SERIALIZED(bootloader)) {
write__cld(_writer, bootloader);
assert(IS_SERIALIZED(bootloader), "invariant");
cldw.add(1);
}
}
_artifacts->tally(cldw);
}

View File

@ -639,11 +639,7 @@ static void write_thread_local_buffer(JfrChunkWriter& chunkwriter, Thread* t) {
size_t JfrRecorderService::flush() {
size_t total_elements = flush_metadata(_chunkwriter);
const size_t storage_elements = flush_storage(_storage, _chunkwriter);
if (0 == storage_elements) {
return total_elements;
}
total_elements += storage_elements;
total_elements = flush_storage(_storage, _chunkwriter);
if (_string_pool.is_modified()) {
total_elements += flush_stringpool(_string_pool, _chunkwriter);
}