You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2017/01/04 12:05:58 UTC

[jira] [Commented] (AVRO-1818) Avoid buffer copy in DeflateCodec.compress and decompress

    [ https://issues.apache.org/jira/browse/AVRO-1818?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15798070#comment-15798070 ] 

ASF GitHub Bot commented on AVRO-1818:
--------------------------------------

Github user nandorKollar closed the pull request at:

    https://github.com/apache/avro/pull/152


> 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
>            Assignee: Nandor Kollar
>
> 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)