RFR: 8256256: UL should not use heap allocation for output string

David Holmes dholmes at openjdk.java.net
Tue Nov 17 03:51:04 UTC 2020


On Tue, 17 Nov 2020 03:04:07 GMT, Yumin Qi <minqi at openjdk.org> wrote:

> Hi, Please review
>   Unified Logging uses 512 bytes buffer on stack for printing out message, above that will allocate heap for extra space needed. This may potentially may cause a circulation when we log the heap allocation and the log message is over 512. The max logging buffer size now is increased to 4096 and above that, output will be truncated.
> 
> Tests: tier1,tier4

Hi Yumin,

Sorry but I don't think it is a reasonable approach to add in truncation where it previously did not occur. And adding a 4K stack buffer can also cause problems if threads are operating near the ends of their stacks (we have had to remove large local stack buffers in the past because of this).

I'm not convinced we can make UL safe from absolutely any context automatically. Most of the time heap allocation is not a problem, it is only from within low-level memory related code that it may be a problem. I think that is a special enough case that we should address it more directly - via a different UL API perhaps, that explicitly avoids heap allocation.

David

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

PR: https://git.openjdk.java.net/jdk/pull/1246


More information about the hotspot-runtime-dev mailing list