Android GLSurfaceView causes leak?
Asked Answered
S

1

7

I am trying to use GLSurfaceView on Android and experiencing problems. I am using the code from this OpenGL article. It works well but when I rotate the device, I notice that the allocated memory is growing.

So I use MAT to check if I have a memory leak and found that there are multiple Activity instances there. If I use dominator tree, I found multiple GLThread objects (but only one is running). So is this an android GLSurfaceview bug or I'm misunderstanding something about GLSurfaceView?

Swetiana answered 29/1, 2012 at 5:1 Comment(1)
do anybody have answer to this?Gel
R
1

This is commonly caused by referring to the Activity context instead of referring to the Application context. When referring to context, always use getApplicationContext() inside the Activity. Avoid using this (inside the Activity) class as it refers to the Activity.

Rakia answered 5/10, 2012 at 18:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.