google/grafika

Memory leak of Texture2dProgram

yanqinglu opened this issue · 0 comments

Seems there are memory leask in Texture2dProgram::Release(). Should delete shaders that have been attached:

if (mProgramHandle > 0) {
int[] ret = new int[1];
GLES20.glGetProgramiv(mProgramHandle, GLES20.GL_ATTACHED_SHADERS, ret, 0);

        int count = ret[0];
        if (count > 0) {
            int[] shaders = new int[count];
            GLES20.glGetAttachedShaders(mProgramHandle, count, ret, 0, shaders, 0);
            for (int shader : shaders) {
                GLES20.glDeleteShader(shader);
            }
        }
    }