Skip to content

OutOfMemoryError reported by apps using processing-core #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
codeanticode opened this issue Jun 23, 2018 · 3 comments
Open

OutOfMemoryError reported by apps using processing-core #469

codeanticode opened this issue Jun 23, 2018 · 3 comments

Comments

@codeanticode
Copy link
Contributor

The "ANRs & crashes" report from Google indicate that java.lang.OutOfMemoryError come from:

A ) 60% processing.core.PApplet.loadImage
on this line:
params[0].wichArray[params[0].pImageNum] = loadImage(params[0].file);

in this class

    ///////////////////////////////////////////////////////////////////////////////
    private class BitmapWorkerTask extends AsyncTask<MyTaskParams, Void, PImage> {
        // load image in background.
        @Override
        protected PImage doInBackground(MyTaskParams... params) {
 
            params[0].wichArray[params[0].pImageNum] = loadImage(params[0].file);

            return params[0].wichArray[params[0].pImageNum];
        }

        @Override
        protected void onPostExecute(PImage result) {
            ressourceCounter++;
        }
    }
    ///////////////////////////////////////////////////////////////////////////////

B ) +- 30 % The ones that point me to a "ProGuard deobfuscation" file:

processing.opengl.PGL.allocateDirectIntBuffer
processing.opengl.Texture.loadPixels
processing.core.PApplet.loadImage
processing.core.PImage.loadPixels

@codeanticode
Copy link
Contributor Author

codeanticode commented Aug 9, 2018

@rich-gg This may be related to #482. In fact, that issue is making me thing that, in general, loading pixels arrays is causing these out-of-memory errors. For instance, every time a PImage is drawn with the OpenGL renderers, its pixels array gets allocated to copy the image to GPU memory. If you are dealing with many high-res images, all these pixel array could exhaust the memory available to the app. In the case of the issue I'm making reference to, the app save the curren contexts of the screen into a pixels array that needs to be big enough to store the entire screen, which could have a very large resolution. Anyways, finally looking into this :-)

@codeanticode
Copy link
Contributor Author

Opened a separate issue on the use of pixels to initialize textures: #483

@codeanticode
Copy link
Contributor Author

Both #482 and #483 are now fixed, and will push a new release of the mode soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant