Skip to content

GLProgram result in memory leak #11835

@shinepengwei

Description

@shinepengwei

In luaTest/OpenGLTest.lua,the sample function createShaderRetroEffect use GLProgram as

local program = cc.GLProgram:create("Shaders/example_ColorBars.vsh", "Shaders/example_ColorBars.fsh")
        program:bindAttribLocation(cc.ATTRIBUTE_NAME_POSITION, cc.VERTEX_ATTRIB_POSITION) 
        program:bindAttribLocation(cc.ATTRIBUTE_NAME_TEX_COORD, cc.VERTEX_ATTRIB_TEX_COORD)
label:setGLProgram( program )

Use GLProgram like this can result in memory leak because Node hold the GLState and GLState hold GLProgram, while GLState will create in GLProgramStateCache and never be release automatically.

We must use removeUnusedGLProgramState by ourself.

What's more, lua do not bind GLProgramStateCache::removeUnusedGLProgramState().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions