You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Daniel Stucky (Created) (JIRA)" <ji...@apache.org> on 2011/11/29 15:43:40 UTC

[jira] [Created] (IO-293) Reduce memory consumption when reading file into byte[]

Reduce memory consumption when reading file into byte[]
-------------------------------------------------------

                 Key: IO-293
                 URL: https://issues.apache.org/jira/browse/IO-293
             Project: Commons IO
          Issue Type: Improvement
          Components: Utilities
    Affects Versions: 2.1
            Reporter: Daniel Stucky


Improvement for org.apache.commons.io.FileUtils method 
public static byte[] readFileToByteArray(File file):

The old implementations used twice the amount of memory than was actually needed to read a file content into a byte[].
E.g. to read a 1GB file 2GB of heap space where needed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (IO-293) Reduce memory consumption when reading file into byte[]

Posted by "Daniel Stucky (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Stucky updated IO-293:
-----------------------------

    Attachment: FileUtils.patch

patch for org.apache.commons.io.FileUtils#readFileToByteArray(File file)
                
> Reduce memory consumption when reading file into byte[]
> -------------------------------------------------------
>
>                 Key: IO-293
>                 URL: https://issues.apache.org/jira/browse/IO-293
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.1
>            Reporter: Daniel Stucky
>         Attachments: FileUtils.patch
>
>
> Improvement for org.apache.commons.io.FileUtils method 
> public static byte[] readFileToByteArray(File file):
> The old implementations used twice the amount of memory than was actually needed to read a file content into a byte[].
> E.g. to read a 1GB file 2GB of heap space where needed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (IO-293) Reduce memory consumption when reading file into byte[]

Posted by "Sebb (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sebb resolved IO-293.
---------------------

    Resolution: Not A Problem

The patch effectively amounts to inlining the code for IOUtils.toByteArray and does not save any memory as far as I can tell.
                
> Reduce memory consumption when reading file into byte[]
> -------------------------------------------------------
>
>                 Key: IO-293
>                 URL: https://issues.apache.org/jira/browse/IO-293
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 2.1
>            Reporter: Daniel Stucky
>         Attachments: FileUtils.patch
>
>
> Improvement for org.apache.commons.io.FileUtils method 
> public static byte[] readFileToByteArray(File file):
> The old implementations used twice the amount of memory than was actually needed to read a file content into a byte[].
> E.g. to read a 1GB file 2GB of heap space where needed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Updated] (IO-293) Reduce memory consumption when reading file into byte[]

Posted by "Daniel Stucky (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/IO-293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Stucky updated IO-293:
-----------------------------

    Affects Version/s:     (was: 2.1)
                       1.4

Sorry, the problem relates to version 1.4 but was already fixed in 2.1
                
> Reduce memory consumption when reading file into byte[]
> -------------------------------------------------------
>
>                 Key: IO-293
>                 URL: https://issues.apache.org/jira/browse/IO-293
>             Project: Commons IO
>          Issue Type: Improvement
>          Components: Utilities
>    Affects Versions: 1.4
>            Reporter: Daniel Stucky
>         Attachments: FileUtils.patch
>
>
> Improvement for org.apache.commons.io.FileUtils method 
> public static byte[] readFileToByteArray(File file):
> The old implementations used twice the amount of memory than was actually needed to read a file content into a byte[].
> E.g. to read a 1GB file 2GB of heap space where needed.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira