[
https://issues.apache.org/jira/browse/DIRMINA-598?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12650510#action_12650510
]
Julien Vermillard commented on DIRMINA-598:
-------------------------------------------
no ByteBuffer pools in 2.0 no ? So it can't apply.
> 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: 2.0.0-M4, 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 is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.