[
https://issues.apache.org/jira/browse/AVRO-1818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15244417#comment-15244417
]
Ryan Blue commented on AVRO-1818:
---------------------------------
[~rohini], thanks for letting us know about this. Would you like to contribute
a patch or pull request that does what you suggest?
> Avoid buffer copy in DeflateCodec.compress and decompress
> ---------------------------------------------------------
>
> Key: AVRO-1818
> URL: https://issues.apache.org/jira/browse/AVRO-1818
> Project: Avro
> Issue Type: Improvement
> Reporter: Rohini Palaniswamy
>
> One of our jobs reading avro hit OOM due to the buffer copy in compress and
> decompress methods which is very inefficient.
> https://github.com/apache/avro/blob/master/lang/java/avro/src/main/java/org/apache/avro/file/DeflateCodec.java#L71-L86
> {code}
> java.lang.OutOfMemoryError: Java heap space
> at java.util.Arrays.copyOf(Arrays.java:3236)
> at
> java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:191)
> at org.apache.avro.file.DeflateCodec.decompress(DeflateCodec.java:84)
> {code}
> I would suggest using a class that extends ByteArrrayOutputStream like
> https://github.com/apache/hadoop/blob/trunk/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/io/DataOutputBuffer.java#L51-L53
> and do
> ByteBuffer result = ByteBuffer.wrap(buf.getData(), 0, buf.getLength());
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)