Mercurial > hg > jdk9-shenandoah > nashorn
changeset 1122:7437eb72fc4e
8065769: OOM on Window/Solaris in test compile-octane-splitter.js
Reviewed-by: sundar, jlaskey
author | hannesw |
---|---|
date | Wed, 03 Dec 2014 14:49:36 +0100 |
parents | 69de08fa3ee6 |
children | c065853b25fe |
files | src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AstSerializer.java |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AstSerializer.java Wed Dec 03 11:43:57 2014 +0100 +++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AstSerializer.java Wed Dec 03 14:49:36 2014 +0100 @@ -48,11 +48,13 @@ private static final int COMPRESSION_LEVEL = Options.getIntProperty("nashorn.serialize.compression", 4); static byte[] serialize(final FunctionNode fn) { final ByteArrayOutputStream out = new ByteArrayOutputStream(); - try (final ObjectOutputStream oout = new ObjectOutputStream(new DeflaterOutputStream(out, - new Deflater(COMPRESSION_LEVEL)))) { + final Deflater deflater = new Deflater(COMPRESSION_LEVEL); + try (final ObjectOutputStream oout = new ObjectOutputStream(new DeflaterOutputStream(out, deflater))) { oout.writeObject(removeInnerFunctionBodies(fn)); } catch (final IOException e) { throw new AssertionError("Unexpected exception serializing function", e); + } finally { + deflater.end(); } return out.toByteArray(); }