Display.save error in device

I get this error in device 
 

java.lang.OutOfMemoryError: int[] of length -2147483648 exceeds the VM limit Java Stack Trace:     com.ansca.corona.JavaToNativeShim.nativeRender(Native Method)     com.ansca.corona.JavaToNativeShim.render(JavaToNativeShim.java:185)     com.ansca.corona.Controller.updateRuntimeState(Controller.java:293)     com.ansca.corona.graphics.opengl.CoronaGLSurfaceView$CoronaRenderer.onDrawFrame(CoronaGLSurfaceView.java:417)     com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1622)     com.ansca.corona.graphics.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1377)

On probing, I found that the display.save function is the one causing this error 

What’s the problem here? 

Sounds like your running out of memory?

Have you tried adding largeHeap = true to your build.settings (iirc) file? (Under the android section)

The heap size is generally affected by loading of “large images” right? 

The image I am trying to display.save is very small… Like 100x100. 
So I am not sure why this error occurs…

P.S I am unable to replicate this error in my devices… I caught the error in my published app. 
So just want to confirm before pushing largeHeap=true in production builds. 

My follow up question would be… Are you loading an image from the devices photo library or camera and then saving it as a small image?

No I’m not.

I am loading the image from a file in DocumentsDirectory.

Also, both the processes dont happen in the same frame. 
I have given a timer delay of 1 for saving the image after it is loaded. 

 

Come to think of it, this file which I am loading  is fairly large.
This file is also an image which I save some time previously in the Documents Directory. The size of this original image is deviceWidth x 3/4*deviceHeight.

So maybe this size causes memory problems in larger devices?

Ok. I just got error despite setting largeHeap=true.
So this has got to be a display.save bug

Sounds like your running out of memory?

Have you tried adding largeHeap = true to your build.settings (iirc) file? (Under the android section)

The heap size is generally affected by loading of “large images” right? 

The image I am trying to display.save is very small… Like 100x100. 
So I am not sure why this error occurs…

P.S I am unable to replicate this error in my devices… I caught the error in my published app. 
So just want to confirm before pushing largeHeap=true in production builds. 

My follow up question would be… Are you loading an image from the devices photo library or camera and then saving it as a small image?

No I’m not.

I am loading the image from a file in DocumentsDirectory.

Also, both the processes dont happen in the same frame. 
I have given a timer delay of 1 for saving the image after it is loaded. 

 

Come to think of it, this file which I am loading  is fairly large.
This file is also an image which I save some time previously in the Documents Directory. The size of this original image is deviceWidth x 3/4*deviceHeight.

So maybe this size causes memory problems in larger devices?

Ok. I just got error despite setting largeHeap=true.
So this has got to be a display.save bug