OpenGLRenderer Memory Leak - 0.7.5

If you found a bug in our library or on our website, please report it in this section. In this forum you can also make concrete suggestions or feature requests.

Moderators: CEGUI MVP, CEGUI Team

royconejo
Just popping in
Just popping in
Posts: 8
Joined: Wed Nov 17, 2010 13:58

OpenGLRenderer Memory Leak - 0.7.5

Postby royconejo » Wed Nov 24, 2010 13:16

Hello =)

I've found a "bug" in CEGUIOpenGLRenderer, basically d_rendererID is declared as static and initialized once with this constructor:

Code: Select all

String OpenGLRenderer::d_rendererID(
"CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module.");


and it's ok since It should never change. But it does:

Code: Select all

    // prefer FBO

    if (((tt_type == TTT_AUTO) || (tt_type == TTT_FBO)) &&
        GLEW_EXT_framebuffer_object)
    {
        d_rendererID += "  TextureTarget support enabled via FBO extension.";
        d_textureTargetFactory =
            new OGLTemplateTargetFactory<OpenGLFBOTextureTarget>;
    }


Whenever a CEGUIOpenGLRenderer is destroyed an re-created, a new " TextureTarget support enabled via FBO extension." string is appended to this static variable. After only a few iterations, the result of calling String& OpenGLRenderer::getIdentifierString() is something like this:

"CEGUI::OpenGLRenderer - Official OpenGL based 2nd generation renderer module. TextureTarget support enabled via FBO extension. TextureTarget support enabled via FBO extension. TextureTarget support enabled via FBO extension. TextureTarget support enabled via FBO extension. TextureTarget support enabled via FBO extension. TextureTarget support enabled via FBO extension. TextureTarget support enabled via FBO extension. TextureTarget support enabled via FBO extension."


I've found it because I'm doing a sort of "application launcher" that needs to bootstrap and finally destroy CEGUI whenever it loads a new application to ensure a clean CEGUI environment for each app.

I personally think static should be removed in this particular case...

Thanks!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: OpenGLRenderer Memory Leak - 0.7.5

Postby Jamarr » Wed Nov 24, 2010 15:50

This is not a memory leak, it is a logic error. And it can be fixed without alter the scope of the variable. We should not simply assume the id is static for no reason. Alternatively we could simply log texture-target support on it's own, instead of appending it to the renderer-id to be logged along side it later. And it makes little sense to append feature-support to the renderer-id anyway. But thanks for catching this :wink:
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

User avatar
Kulik
CEGUI Team
Posts: 1382
Joined: Mon Jul 26, 2010 18:47
Location: Czech Republic
Contact:

Re: OpenGLRenderer Memory Leak - 0.7.5

Postby Kulik » Thu Dec 02, 2010 15:37

I will look into this.. I think OpenGL renderer shouldn't be appending text to the static ID String at all.


Return to “Bug Reports, Suggestions, Feature Requests”

Who is online

Users browsing this forum: No registered users and 10 guests