mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Emmanuel Lecharny (JIRA)" <j...@apache.org>
Subject [jira] Closed: (DIRMINA-713) IoBufferHexDumper.getHexdump() over-allocates memory
Date Fri, 22 Jan 2010 17:37:21 GMT

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

Emmanuel Lecharny closed DIRMINA-713.
-------------------------------------


> IoBufferHexDumper.getHexdump() over-allocates memory
> ----------------------------------------------------
>
>                 Key: DIRMINA-713
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-713
>             Project: MINA
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.0.0-M5
>            Reporter: Justin Mason
>            Assignee: Emmanuel Lecharny
>            Priority: Minor
>             Fix For: 2.0.0-M6
>
>         Attachments: p
>
>
> hey folks.  in IoBufferHexDumper.getHexdump(), we see this:
> {code}
>         boolean truncate = in.remaining() > lengthLimit;
>         int size;
>         if (truncate) {
>             size = lengthLimit;
>         } else {
>             size = in.remaining();
>         }
>         if (size == 0) {
>             return "empty";
>         }
>         StringBuilder out = new StringBuilder(in.remaining() * 3 - 1);
> {code}
> note that the allocation uses in.remaining(), even though it'll only
> insert the number of items indicated by "size".  If the buffer is 
> particularly large, this is unnecessary and wasteful of memory.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message