I tried the FileConnection API example (ImageViewer) from forum Nokia in 6680. I found that the example crashes when I try to open an image of size about 100 KB. I studied the problem a bit further and noticed that the problem arises when:
1. Program reads a jpeg image into a byte array. The size of array is 154890 B. The size of total memory is 1000000 B and the size of free memory is 610396 B after the reading of the image into the byte array.
2. Program tries to create an Image object from the byte array. This creation attemp fails and it throws an OutOfMemotyException. The error condition occurs on the row 80 of ImageCanvas.java:
currentImage = Image.createImage(imageData, 0, length);
Isn't this a bit strange because there is so much free memory available? I can also to read a lot of larger images into a byte array but it is the creation of a Image object which get the program crash?