[ https://issues.apache.org/jira/browse/DIRMINA-1061?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15756323#comment-15756323 ]
Emmanuel Lecharny commented on DIRMINA-1061: -------------------------------------------- Indeed. I totally missed your point : as soon as you have your own implementation of {{IoBuffer}}, we must call the {{free()}} method after having allocated a buffer when there is nothing to read. Can you provide a patch that I will apply to the code base ? Many thanks ! > When AbstractPollingIoProcessor read nothing, free the temporary buffer > should be better > ---------------------------------------------------------------------------------------- > > Key: DIRMINA-1061 > URL: https://issues.apache.org/jira/browse/DIRMINA-1061 > Project: MINA > Issue Type: Improvement > Components: Core > Affects Versions: 2.0.16 > Reporter: Mark > Priority: Minor > > {code:title=org.apache.mina.core.polling.AbstractPollingIoProcessor.java|borderStyle=solid} > private void read(S session) { > IoSessionConfig config = session.getConfig(); > int bufferSize = config.getReadBufferSize(); > IoBuffer buf = IoBuffer.allocate(bufferSize); > //... > //... > if (readBytes > 0) { > IoFilterChain filterChain = session.getFilterChain(); > filterChain.fireMessageReceived(buf); > buf = null; > if (hasFragmentation) { > if (readBytes << 1 < config.getReadBufferSize()) { > session.decreaseReadBufferSize(); > } else if (readBytes == config.getReadBufferSize()) { > session.increaseReadBufferSize(); > } > } > } > {code} > it seems that this method will be called when session closing. > it'll better to call buf.free() if readBytes==0, to help allocator recycle > this buffer, thx! -- This message was sent by Atlassian JIRA (v6.3.4#6332)