The Eventlog system keeps an array of events which almost completely consist of variable sized string messages.
The message buffer consists of fixed-sized records with a fixed-sized char array for those messages. This is not a good fit. Mostly, those buffers are too large and we waste space. Then, occasionally a message is too large and we truncate. To avoid truncation, stopgap solutions have been added in the past (e.g.JDK-8204551) which would just increase the array size, therefore avoiding truncation (for now) but increasing memory waste.
A better solution would be to hold the strings in var-length buffers. We do not want strdup since that is too expensive and events may be written in situations where C heap is flaky.
So I developed a solution where the strings live outside the event records in a FIFO buffer of variable length strings - each string just uses exactly as much memory as needed, and truncation is not a problem anymore. This allows us also to increase the number of event records held.
The message buffer consists of fixed-sized records with a fixed-sized char array for those messages. This is not a good fit. Mostly, those buffers are too large and we waste space. Then, occasionally a message is too large and we truncate. To avoid truncation, stopgap solutions have been added in the past (e.g.
A better solution would be to hold the strings in var-length buffers. We do not want strdup since that is too expensive and events may be written in situations where C heap is flaky.
So I developed a solution where the strings live outside the event records in a FIFO buffer of variable length strings - each string just uses exactly as much memory as needed, and truncation is not a problem anymore. This allows us also to increase the number of event records held.
- relates to
-
JDK-8204551 Event descriptions are truncated in logs
- Resolved
-
JDK-8221851 Use of THIS_FILE in hotspot invalidates precompiled header on Linux/GCC
- Resolved
-
JDK-8224600 Provide VM.events command
- Resolved