Urgent Really Emergency Question: Can I Load Non-32 Bit Images?

Hi Maurício,

Did you try to load only this image and nothing else? Simply a new test project that loads this image first for testing purposes?

The issue might also be a “lazy” Java garbage collector issue on the device. Even though Corona has a lot of fallback mechanisms to attempt to force garbage collection and automatically down-sample/scale images, if there isn’t enough memory, some devices still refuse to allocate memory if the garbage collector isn’t granted enough time. If that’s indeed the issue, the only workaround is to load images based on a timer or effectively “on demand”.

Brent

Hello! I made this program, and it crashes on second line.

[lua]print(“image load attempt”);

local imgtest = display.newImageRect(“data/monkey.png”, 1920, 2016);

print(“image load success”);[/lua]

Also tried this:

[lua]print(“start”);

local imgjnk1 = display.newImageRect(“data/10240.png”, 1024, 1024);

local imgjnk2 = display.newImageRect(“data/10241.png”, 1024, 1024);

local imgjnk3 = display.newImageRect(“data/10242.png”, 1024, 1024);

local imgjnk4 = display.newImageRect(“data/10243.png”, 1024, 1024);

imgjnk1:removeSelf();

imgjnk2:removeSelf();

imgjnk3:removeSelf();

imgjnk4:removeSelf();

collectgarbage();

print(“image load attempt”);

local imgtest = display.newImageRect(“data/monkey.png”, 1920, 2016);

print(“image load success”);[/lua]

It crashes as soon as it reaches the imgtest line.

It is interesting to say that in this case it generates lots of messages of growing heap.

Among other tests: Tried to load much more images in the memory (like 100mb) before trying to loading this image. Tried to swamp the memory with doubles (creating a arrays of NUMBERs) of about 256mb before loading the image.

Tried to load the image later, earlier, in other ways…

None of that worked, the thing just crash with out of memory error, always, no matter where or when I try to load it, or what image as long it is bigger than 1024x1024

And like I said, it worked fine with the Marmalade version of the app (in fact to make the Corona version I copied and pasted most of Marmalade code and edited to make the syntax fit Lua instead of C)

Hi Maurício,

Can you e-mail me this image to test with? brent (at) coronalabs (dot) com. Obviously, I won’t use it for anything other than testing, if this is some artwork you’ve created or licensed from an artist.

Thanks,

Brent

Sure sure! But how I find your e-mail?

brent (at) coronalabs (dot) com is the email address

What device are you running it on? Different iPhones and different Android phones have a max texture size.

See here for the sizes http://www.uchidacoonga.com/2012/04/quick-tip-max-texture-size/

Matthew

I mentioned earlier that the device is a Xperia Play running Android 2.3 and that it reports maximum texture size of 4096

But thanks for the e-mail :slight_smile:

Doh! Totally missed that.

Just to update followers of the topic:

I continued to talk with Brent over e-mail, he requested me to make a bug report, I did, and they did found a bug, one particular device where they tested had the issue I am reporting here on this topic (the device in question is a Nexus One with Android 2.3)

Now I am following up with Brent on e-mail.

Also, on the bug-report they stated to me that it CAN load the image as 16-bit image, it is one of the fallback attempts when it gets a out of memory error.

I want to request that it should be possible to do this manually (my image like I said originally, that refuse to load, would look just fine in 16-bit, but I would love to control that, and create the 16-bit image myself and thus load it with predictable colours).

Just to update followers of the topic:

I continued to talk with Brent over e-mail, he requested me to make a bug report, I did, and they did found a bug, one particular device where they tested had the issue I am reporting here on this topic (the device in question is a Nexus One with Android 2.3)

Now I am following up with Brent on e-mail.

Also, on the bug-report they stated to me that it CAN load the image as 16-bit image, it is one of the fallback attempts when it gets a out of memory error.

I want to request that it should be possible to do this manually (my image like I said originally, that refuse to load, would look just fine in 16-bit, but I would love to control that, and create the 16-bit image myself and thus load it with predictable colours).