ppkarwasz commented on issue #3569:
URL: 
https://github.com/apache/logging-log4j2/issues/3569#issuecomment-2749100490

   Hi @shaonan666,
   
   `RingBufferLogEvent` does not have a fixed retained size and can gain weight 
in time if all [garbage-free logging 
options](https://logging.apache.org/log4j/2.x/manual/garbagefree.html) are 
enabled. This is due to the fact that **reusable** objects are reused instead 
of being garbage-collected. A retained size of 744 is nothing alarming.
   
   You should check the following options:
   
   - 
[`log4j2.enableThreadlocals`](https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.enableThreadlocals)
 enables GC-free logging.
   - If GC-free mode is enabled 
[`log4j2.messageFactory`](https://logging.apache.org/log4j/2.x/manual/systemproperties.html#log4j2.messageFactory)
 defaults to `ReusableMessageFactory` and a `StringBuilder` with variable size 
(from 128 to 518) is used, as shown by your graphs.
   - If you additionally enable 
[`log4j2.garbagefreeThreadContextMap`](https://logging.apache.org/log4j/2.x/manual/garbagefree.html#log4j2.garbagefreeThreadContextMap)
 each log event will retain and reuse an instance of `SortedArrayStringMap`, 
which also appears in your graphs.
   
   
   > [!NOTE]
   > Log4j uses a fuzzy-matching algorithm to match both the official spelling 
of the configuration properties and some obsolete spellings. You should look if 
your configuration properties have names **similar** to those above, that start 
with `log4j` or `org.apache.logging`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to