You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2014/09/05 11:38:28 UTC

[jira] [Closed] (DIRMINA-598) ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool

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

Emmanuel Lecharny closed DIRMINA-598.
-------------------------------------
    Resolution: Won't Fix

Branch 1.1 is dead.

> ByteBuffer passed to ProtocolEncoderOutput.write(ByteBuffer) does not get released back to the pool
> ---------------------------------------------------------------------------------------------------
>
>                 Key: DIRMINA-598
>                 URL: https://issues.apache.org/jira/browse/DIRMINA-598
>             Project: MINA
>          Issue Type: Bug
>          Components: Filter
>    Affects Versions: 1.1.7
>            Reporter: Greg Dhuse
>             Fix For: 1.1.8
>
>
> When pooled ByteBuffers are used in conjunction with a ProtocolCodecFilter, buffers passed to ProtocolEncoderOutput.write() do not get released back to the pool in all circumstances, causing unnecessary memory allocation.  
> The following patch appears to resolve this issue in a simple filter chain, but it should be verified that there is no case where this change would cause a buffer to be released too early.
> Best regards,
>  Greg
> Index: core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java
> ===================================================================
> --- core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(revision 657929)
> +++ core/src/main/java/org/apache/mina/filter/codec/ProtocolCodecFilter.java	(working copy)
> @@ -186,6 +186,10 @@
>      public void messageSent(NextFilter nextFilter, IoSession session,
>              Object message) throws Exception {
>          if (message instanceof HiddenByteBuffer) {
> +			// Release buffer originally passed to ProtocolEncoderOutput.write(ByteBuffer)
> +			// See http://mina.apache.org/report/1.1/apidocs/org/apache/mina/common/ByteBuffer.html
> +			((HiddenByteBuffer) message).release();
> +        	
>              return;
>          }
>  



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