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

Chia-Ping Tsai resolved KAFKA-21156.
------------------------------------
    Fix Version/s: 4.5.0
       Resolution: Fixed

> Avoid unnecessary char[] copy in 
> ProcessorRecordContext#residentMemorySizeEstimate
> ----------------------------------------------------------------------------------
>
>                 Key: KAFKA-21156
>                 URL: https://issues.apache.org/jira/browse/KAFKA-21156
>             Project: Kafka
>          Issue Type: Improvement
>            Reporter: Chia-Ping Tsai
>            Assignee: Yen-Ting Li
>            Priority: Trivial
>             Fix For: 4.5.0
>
>
> {code:java}
>     public long residentMemorySizeEstimate() {
>         long size = 0;
>         size += Long.BYTES; // value.context.timestamp
>         size += Long.BYTES; // value.context.offset
>         if (topic != null) {
>             size += topic.toCharArray().length;
>         }
>         size += Integer.BYTES; // partition
>         for (final Header header : headers) {
>             size += header.key().toCharArray().length;
>             final byte[] value = header.value();
>             if (value != null) {
>                 size += value.length;
>             }
>         }
>         return size;
>     } {code}
> toCharArray().length -> topic.length()



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to