Skip to content
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

Always call destroy on local render script object #194

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpelgrim
Copy link

@jpelgrim jpelgrim commented Mar 6, 2021

StrictMode reports that the local rs object leaks memory if it does not call destroy() on the local reference. Always calling destroy() explicitly (when not null) fixes this memory leak.

E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    java.lang.Throwable: Explicit termination method 'destroy' not called
        at dalvik.system.CloseGuard.open(CloseGuard.java:180)
        at android.renderscript.Element.<init>(Element.java:1094)
        at android.renderscript.Element.createPixel(Element.java:1265)
        at android.renderscript.Element.RGBA_8888(Element.java:639)
        at android.renderscript.Allocation.elementFromBitmap(Allocation.java:2762)
        at android.renderscript.Allocation.typeFromBitmap(Allocation.java:2772)
        at android.renderscript.Allocation.createFromBitmap(Allocation.java:2811)
        at jp.wasabeef.glide.transformations.internal.RSBlur.blur(RSBlur.java:39)
        at jp.wasabeef.glide.transformations.BlurTransformation.transform(BlurTransformation.java:79)
        at jp.wasabeef.glide.transformations.BitmapTransformation.transform(BitmapTransformation.java:50)

StrictMode reports that the local rs object leaks memory if it does not call destroy on the local reference. Always calling destroy() explicitly (when not null) fixes this memory leak.

E/StrictMode: A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
    java.lang.Throwable: Explicit termination method 'destroy' not called
        at dalvik.system.CloseGuard.open(CloseGuard.java:180)
        at android.renderscript.Element.<init>(Element.java:1094)
        at android.renderscript.Element.createPixel(Element.java:1265)
        at android.renderscript.Element.RGBA_8888(Element.java:639)
        at android.renderscript.Allocation.elementFromBitmap(Allocation.java:2762)
        at android.renderscript.Allocation.typeFromBitmap(Allocation.java:2772)
        at android.renderscript.Allocation.createFromBitmap(Allocation.java:2811)
        at jp.wasabeef.glide.transformations.internal.RSBlur.blur(RSBlur.java:39)
        at jp.wasabeef.glide.transformations.BlurTransformation.transform(BlurTransformation.java:79)
        at jp.wasabeef.glide.transformations.BitmapTransformation.transform(BitmapTransformation.java:50)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant