小编Lia*_*kos的帖子

返回指向同一变量的指针会泄漏内存吗?

这段代码会泄漏内存吗?

SDL_Texture* texture;
SDL_Surface* surface;
int infinity = 99999999;
for (int i=0; i<infinity; i++) {
   surface = IMG_Load("path/to/image.png");
   texture = SDL_CreateTextureFromSurface(renderer, surface);
}
Run Code Online (Sandbox Code Playgroud)

在重新分配变量之前,我是否需要每次都消除(从内存中清除)表面和纹理?

c++ memory pointers sdl sdl-2

1
推荐指数
1
解决办法
171
查看次数

标签 统计

c++ ×1

memory ×1

pointers ×1

sdl ×1

sdl-2 ×1