[ 
https://issues.apache.org/jira/browse/AVRO-1818?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thiruvalluvan M. G. updated AVRO-1818:
--------------------------------------
    Component/s: java

> Avoid buffer copy in DeflateCodec.compress and decompress
> ---------------------------------------------------------
>
>                 Key: AVRO-1818
>                 URL: https://issues.apache.org/jira/browse/AVRO-1818
>             Project: Apache Avro
>          Issue Type: Improvement
>          Components: java
>            Reporter: Rohini Palaniswamy
>            Assignee: Nandor Kollar
>            Priority: Major
>
> 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
(v7.6.3#76005)

Reply via email to