You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Android OutOfMemoryError occurs when readTiff for 400MB tif file #31
Please fill out as much known and relevant information as possible.
Version Information:
TIFF Java Version: 2.0.2
TIFF Java Source: Central Repository
IDE Name & Version: Android Studio 3.2.1
Maven Version: (mvn -version) : gradle:3.2.1
Java Version: (java -version) : Android-26
Platform & OS: Android
Other Relevant Libraries:
Expected Results:
What did you expect to happen?
Open the big tif file : TiffReader.readTiff(tiffFile)
Observed Results:
What happened instead?
AndroidRuntime: FATAL EXCEPTION: Thread-19
java.lang.OutOfMemoryError: Failed to allocate a 536870928 byte allocation with 25165824 free bytes and 234MB until OOM, target footprint 316450016, growth limit 536870912
How often does this occur? Always
Output:
Any logs, errors, or output messages?
java.lang.OutOfMemoryError: Failed to allocate a 536870928 byte allocation with 25165824 free bytes and 234MB until OOM, target footprint 316450016, growth limit 536870912
at java.util.Arrays.copyOf(Arrays.java:3161)
at java.io.ByteArrayOutputStream.grow(ByteArrayOutputStream.java:118)
at java.io.ByteArrayOutputStream.ensureCapacity(ByteArrayOutputStream.java:93)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:153)
at mil.nga.tiff.io.IOUtils.copyStream(IOUtils.java:104)
at mil.nga.tiff.io.IOUtils.streamBytes(IOUtils.java:83)
at mil.nga.tiff.io.IOUtils.fileBytes(IOUtils.java:67)
at mil.nga.tiff.TiffReader.readTiff(TiffReader.java:51)
at mil.nga.tiff.TiffReader.readTiff(TiffReader.java:35)
at com.mvsoftech.mvgis.forestServices.DemFinder$2.run(DemFinder.java:49)
at java.lang.Thread.run(Thread.java:919)
Steps to Reproduce:
just run app in mobile
Relevant Code:
// Code to reproduce the problem?TIFFImagetiffImage = TiffReader.readTiff(tiffFile);
Test Files:
Links to any files needed for testing?
Additional Information:
Any additional configuration, data, or information that might help with the issue?
This implementation loads the entire tiff file into memory for raster random read access. Your reported error occurred attempting to copy the file into memory. Allocation of ~537mb with a growth limit of ~537mb.
Activity
bradh commentedon Jun 11, 2021
Can you provide file(s) that demonstrate the problem? Even the results of a
gdalinfodump may help.Also, what do you have set for your Dalvik heap size to?
bosborn commentedon Jun 21, 2021
This implementation loads the entire tiff file into memory for raster random read access. Your reported error occurred attempting to copy the file into memory. Allocation of ~537mb with a growth limit of ~537mb.
Try increasing the heap size.