On Wed, 1 Nov 2023 19:23:14 GMT, Alex Menkov <amen...@openjdk.org> wrote:
> Segment file is closed from DumpWriter dtor. > On Unix systems `remove` can delete an opened file, on Windows it fails with > "access denied". > The fix destroys DumpWriter objects for segment files after all data are > dumped Sorry I don't understand the fix here. You changed the AbstractDumpWriter to be a C-heap object instead of ResourceObject and then delete it, so invoking a destructor, which AFAICS does nothing in terms of removing any files. ??? BTW with this change you may be able to remove the ResourceMark prior to allocating `local_writer` (line 2350). src/hotspot/share/services/heapDumper.cpp line 1959: > 1957: // Delete selected segmented heap file nevertheless > 1958: if (remove(path) != 0) { > 1959: log_info(heapdump)("Remove segment file (%d) failed (%d)", i, > errno); Suggestion: "Removal of segment file ..." ------------- PR Review: https://git.openjdk.org/jdk/pull/16462#pullrequestreview-1709514524 PR Review Comment: https://git.openjdk.org/jdk/pull/16462#discussion_r1379635376