Madan Jampani
Committed by Gerrit Code Review

Fix Kryo serialization memory leak

Change-Id: I122cb811971aef1a70a73c3335b485125125c66b
......@@ -233,6 +233,7 @@ public final class KryoNamespace implements KryoFactory, KryoPool {
*/
public byte[] serialize(final Object obj, final int bufferSize) {
ByteBufferOutput out = new ByteBufferOutput(bufferSize, MAX_BUFFER_SIZE);
try {
Kryo kryo = borrow();
try {
kryo.writeClassAndObject(out, obj);
......@@ -241,6 +242,9 @@ public final class KryoNamespace implements KryoFactory, KryoPool {
} finally {
release(kryo);
}
} finally {
out.release();
}
}
/**
......