RFR: 8292989: Avoid dynamic memory in AsyncLogWriter [v4]

Xin Liu xliu at openjdk.org
Mon Sep 12 14:01:53 UTC 2022


On Thu, 8 Sep 2022 11:28:08 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:

>> Xin Liu has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   fix MSVC warning C4267
>>   
>>   MSVC reports logAsyncWriter.cpp(62): warning C4267: 'initializing': conversion from
>>   'size_t' to 'int', possible loss of data
>
> Hi Xin,
> 
> getting closer. Remarks inline.
> 
> Cheers, Thomas

hi, @tstuefe,

Thank you for reviewing this patch! I addressed most of the requests. I haven't integrated the 'len' hint yet. It's not I don't intend to. On the contrary, I found that reducing the size of 'Message' is very useful to avoid buffer overflow. I took you advice and saved the explicit c-str pointer. Another observation is that almost all `Message::_output` pointers are the same when we use just one LogOutput file. eg. one may just save all GC related activities using `-Xlog:gc*=debug,file=gc.log`. I think I can save identical pointers with `len` hint. 

Can we leave `len` optimization to the next patch? This patch just focuses on one problem: 'dynamic memory allocation'. I replaced linked-list with the pre-allocated buffer. I use NMT to validate it. It's stable with the upfront memory chunks(2*M by default):

                   Logging (reserved=2048KB, committed=2048KB)
                            (malloc=2048KB #4)

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

PR: https://git.openjdk.org/jdk/pull/10092


More information about the hotspot-runtime-dev mailing list