[Mono-bugs] [Bug 652299] New: stream.Read crashes with Java.IO.IOException for big files

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 9 05:26:01 EST 2010



           Summary: stream.Read crashes with Java.IO.IOException for big
    Classification: Mono
           Product: MonoDroid
           Version: SVN
          Platform: Other
        OS/Version: Windows 7
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Runtime
        AssignedTo: mkestner at novell.com
        ReportedBy: Benjamin at exDream.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:
Gecko/20100625 Firefox/3.6.6

The following code works fine for files below 1MB, but we have some big
textures (e.g. 1024x1024) with 1-2MB and they (always reproducible) crash when
attempting to read the input stream:

InputStream stream = assetManager.Open(contentFile, Access.Streaming);
//TODO: this crashes with Java.IO.IOException for big files:
byte[] buffer = new byte[stream.Available()];

We also tried to read the files in smaller chunks, but that does not help
either, it still crashes when reading big files:

//TODO: does not help either!
byte[] buffer = new byte[stream.Available()];
// Read in only 4kb blocks!
int offset = 0;
const int ReadLength = 4*1024;
while (offset < buffer.Length)
    int read = buffer.Length - offset;
    if (read > ReadLength)
        read = ReadLength;
    stream.Read(buffer, offset, read);

For now we just use smaller textures and compression, but sooner or later we
will want to load bigger files. We also run out of memory pretty quickly with
20MB of textures, but this is probably just a GC issue that you are working on

Reproducible: Always

Steps to Reproduce:
Just load any big file with 1MB or above.
Actual Results:  
stream.Read will crash with Javas IOException. Tested with Android Motorola
Droid and a Tegra2 Android device. Also happens in the Emulator.

Expected Results:  
Allow to load bigger files of 1MB and above.

Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list