Fix memory leak in GzipHandler (#1429)

Looks like this leak shows itself only with asynchronous responses.

Some relevant info: http://www.devguli.com/blog/eng/java-deflater-and-outofmemoryerror/

Signed-off-by: Denis Nedelyaev <denvned@gmail.com>
This commit is contained in:
Denis Nedelyaev 2017-03-30 04:15:32 +03:00 committed by Greg Wilkins
parent c366934d30
commit 724c5b7da3
1 changed files with 5 additions and 1 deletions

View File

@ -610,9 +610,13 @@ public class GzipHandler extends HandlerWrapper implements GzipFactory
@Override
public void recycle(Deflater deflater)
{
deflater.reset();
if (_deflater.get()==null)
{
deflater.reset();
_deflater.set(deflater);
}
else
deflater.end();
}
/* ------------------------------------------------------------ */