On Tue, 8 Apr 2025 11:44:52 GMT, Kevin Walls <kev...@openjdk.org> wrote:

> Updated. Additionally, the total_length check at line 2760 is wrong now. But 
> it is also redundant, we use copy_expand_pid to do our length checks on 
> expansion. Use max_digit_chars to reduce buffer length in those 
> copy_expand_pid calls, to leave room for possible later sequence numbers 
> (this is very conservative).
> 
> On longer path lengths, worth noting that using MAXPATHLEN (4k) is higher 
> than outputStream::print_cr allows. This means we can get through all of 
> HeapDumper::dump_heap(bool oome) and call HeapDumper::dump() which uses: 2606 
> out->print_cr("Dumping heap to %s ...", path); ..and will show a VM warning 
> like "outputStream::do_vsnprintf output truncated"
> 
> Again, very very long HeapDumpPaths are not efficient. 8-)

I keep thinking that such a coding can benefit from using stringStream; it 
makes most of the associated buffer counting etc obsolete, supports dynamic 
buffers, or optionally can be laid over a fixed-sized buffer and then handles 
truncation. It does not yet provide a way to report truncation, but that can be 
added really easily.

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

PR Comment: https://git.openjdk.org/jdk/pull/24482#issuecomment-2786180952

Reply via email to