leak issue on some cards only

maybe i can find some help on this forum :slight_smile:

this is quiet a strange issue,
i just want first to see if someone already faced it or if there are obvious repsonses.

I have a 2d application based on SDL/OpenGL (and cegui but lets assume problem is not in cegui).

i have a big leak on some PC only (even sometimes memory figure doesnt make sense it grows very quickly) when i am loading some 2d textures and freeing them.

to load a texture i do:
SDL_Surface *t = IMG_Load(filename);
hxSurface *work = LoadSurface(path,t);

where LoadSurface is kind of:

and in the freeSurface i do a:

in the render loop i do:
glBindTexture(GL_TEXTURE_2D, target->textureList[(i*target->xChunks)+j]);

glTexCoord2f(u1, v1); glVertex2f(sx, sy);
glTexCoord2f(u2, v1); glVertex2f(sx+sw, sy);
glTexCoord2f(u2, v2); glVertex2f(sx+sw, sy+sh);
glTexCoord2f(u1, v2); glVertex2f(sx, sy+sh);


this is basic code;
my nigtmare is that on some pc it works.
and others no. obsviously on my development setup there is no leak …

any idea about something i forgot and that is ok on some drivers; not ok on some others? looks like on integrated intel graphic card problem is present.

on my “not leaking” pc glIntercept doesnt show any error nor leak.

i think i am forgetting a gl something to clear buffers or some memory, but dont know where.

in fact i dont think it is a “high level code” issue because as i said on most computers there is NO leaks. And textures are pretty bigs, so really if some high level code error was there i would have detected on all pcs.
And when leak occurs it is big.
The version is debug on both platform.

In fact another clue is that it looks like memory usages (ram memory) seems to increase extremely fast on leaking pc. could it be that some card cannot stores the textures in their video memory so this special scenario make ram to increase and expose some error code return from opengl api that i would not handle properly ?

hehe this one will busy me some times …

any idea welcome!

hxSurface *work

Do you free that too, once you have done the call to glTexImage2D ?

Something that may mitigate problems on buggy implementation is to use a finite and constant pool of GL texture ids, (so never glDeleteTextures) and just glTexImage2D the data needed.

it could help
actually on a faulty pc i got this with glintercept which is suspicious :
ImageManager::Destructor - OpenGL id 1 is still active.
… x 400 times when my application exit.

on my pc i didnt see this. This leak is texture related right ?

found the issue.
in nvdia if you call “glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);” and the texture has still be configured to have a mag_filter then the driver leaks …
just removing
in the render looks solve my problems. (at least 2 of the faulty pcs)