Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-597

causing java.lang.OutOfMemoryError: Java heap space when downloading more that 2gb file

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Information Provided
    • None
    • None
    • Compressors
    • None

    Description

      I am using ZipArchiveOutputStream to download the file.

      causing java.lang.OutOfMemoryError: Java heap space when downloading more that 2gb file

       

       

      protected byte[] BUFFER = new byte[8 * 1024];

        void writeToZipOutputStream(InputStream is, ZipArchiveOutputStream zos) throws Exception, IOException
        {
          int i = 0;
          try
          {

            while ((i = is.read(BUFFER)) != -1)
           

      {         zos.write(BUFFER, 0, i);       }

            zos.flush();
            zos.closeArchiveEntry();
          }
          finally
         

      {       IOUtils.closeQuietly(is);     }

        }

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            anupamamanish.s Anupama Shinde
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: