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

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

GitHub user nandorKollar opened a pull request:

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

    AVRO-1818 - Avoid buffer copy in DeflateCodec.compress and decompress

    

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/nandorKollar/avro master

Alternatively you can review and apply these changes as the patch at:

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

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #152
    
----
commit 692c478bcb8041e2c9aec9ec273a16814a219497
Author: Nandor Kollar <[email protected]>
Date:   2016-11-04T15:30:55Z

    AVRO-1818 - Avoid buffer copy in DeflateCodec.compress and decompress

----


> 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)

Reply via email to