[
https://issues.apache.org/jira/browse/LOG4J2-2724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16979333#comment-16979333
]
Dzmitry Anikechanka commented on LOG4J2-2724:
---------------------------------------------
Hi [~rpopma],
I've double checked - SimpleMessage object size is 2 time bigger that message
that it holds because every character in the string holds 2 bytes of memory, so
seems like indeed String and CharSequence fields refers to the same string in
the memory and this is correct that size of object is 2 time bigger that logged
message.
Best regards,
Dzmitry
> SimpleMessage - message duplication (String and CharSequence fields)
> --------------------------------------------------------------------
>
> Key: LOG4J2-2724
> URL: https://issues.apache.org/jira/browse/LOG4J2-2724
> Project: Log4j 2
> Issue Type: Bug
> Components: API
> Affects Versions: 2.12.1
> Reporter: Dzmitry Anikechanka
> Priority: Minor
>
> org.apache.logging.log4j.message.SimpleMessage class contains 2 fields:
> {code:java}
> private String message;
> private transient CharSequence charSequence; {code}
> These 2 fields contains the message that should be logged.
> So as the result the message is duplicated and it can cause significant
> payload on memory in case of logging large messages.
> Could you please fix it or explain why the message is duplicated?
> Thanks,
> Dzmitry
--
This message was sent by Atlassian Jira
(v8.3.4#803005)