[
https://issues.apache.org/jira/browse/DIRMINA-1061?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Mark updated DIRMINA-1061:
--------------------------
Attachment: mina-core-2.0.16.patch
Sorry for reply so late, I create a patch file base on 2.0.16 tag, please see
the attached, only add 1 line code in read(S session) method.
{code}
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();
}
}
} else {
buf.free();//release temporary buffer when read nothing
}
{code}
Thank you for you kindly accept this minor change!
> 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
> Attachments: mina-core-2.0.16.patch
>
>
> {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)