[ 
https://issues.apache.org/jira/browse/LOG4J2-1684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15647805#comment-15647805
 ] 

Remko Popma commented on LOG4J2-1684:
-------------------------------------

Commit 0413ea6 lets both StructuredDataMessage and StructuredDataId implement 
StringBuilderFormattable.

Still need to understand why StructuredDataMessage::asString (line 298) needs 
to call StructuredDataId::makeId.
Can't this line
{code}
sdId = sdId.makeId(structuredDataId);
{code}
be replaced by the below?
{code}
sdId = structuredDataId == null ? sdId : structuredDataId;
{code}
(Especially since the only use for the {{sdId}} object is to render it to text 
it seems unnecessary to potentially create a new instance.)

> (GC) Avoid allocating temporary objects in StructuredDataMessage
> ----------------------------------------------------------------
>
>                 Key: LOG4J2-1684
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-1684
>             Project: Log4j 2
>          Issue Type: Improvement
>          Components: API
>    Affects Versions: 2.7
>            Reporter: Remko Popma
>
> Make StructuredDataMessage garbage-free.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to