Memory leak SDL while using SDL_CreateTextureFromSurface

懵懂的女人 提交于 2019-12-02 12:53:19

问题


I'm learning SDL and I've noticed that I have memory leak when I have this line in my code:

m_TextureMap["napis"]= SDL_CreateTextureFromSurface( getRenderer(), textSurface );

I have SDL_FreeSurface(textSurface); right after the first one.

When I comment out only this line, there's no memory leak.

What am I doing wrong? Is there anything else I need to clean except for SDL_FreeSurface(textSurface) ?

P.S. getRenderer is function that returns global SDL renderer, I use this function a lot in other places and I'm sure it doesn't cause leak.

m_TextureMap is just a map where I store textures

textSurface is pointer to SDL_Surface

来源:https://stackoverflow.com/questions/24938695/memory-leak-sdl-while-using-sdl-createtexturefromsurface

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!