You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Carter Kozak (JIRA)" <ji...@apache.org> on 2018/07/12 02:04:00 UTC

[jira] [Closed] (LOG4J2-2373) StringBuilder escapeJson performs unnecessary Memory Allocations

     [ https://issues.apache.org/jira/browse/LOG4J2-2373?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carter Kozak closed LOG4J2-2373.
--------------------------------

> StringBuilder escapeJson performs unnecessary Memory Allocations
> ----------------------------------------------------------------
>
>                 Key: LOG4J2-2373
>                 URL: https://issues.apache.org/jira/browse/LOG4J2-2373
>             Project: Log4j 2
>          Issue Type: Bug
>    Affects Versions: 2.11.0
>            Reporter: Kevin Andrew Meurer
>            Assignee: Carter Kozak
>            Priority: Major
>             Fix For: 3.0.0, 2.11.1
>
>
> The StringBuilders.escapeJson function currently uses the string builder's insert method to add elements to an existing builder for the purposes of escaping special characters.  Unfortunately, this leads to a loop that regularly expands the builder capacity, causing issues at scale.
> A better approach would do a first run through to compute the total space required for the addition and then fill that space using the current method.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)