Jump to content

  • Log In with Google      Sign In   
  • Create Account

glDeleteTextures does not remove picture from memory


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 Vorel512   Members   -  Reputation: 130

Like
0Likes
Like

Posted 09 May 2012 - 06:02 AM

Hi Experts,

I've run into an irritating problem.
After I load a picture with GLKTextureLoader, I can not free it from memory.
When I call glDeleteTextures(1,&texturename), nothing happens.

I use OpenglES2.0 on iOS5.1

Thanks in advance!

Sponsor:

#2 Brother Bob   Moderators   -  Reputation: 8631

Like
0Likes
Like

Posted 09 May 2012 - 06:43 AM

What do you mean with "nothing happens", how do you observe that "nothing happens" and what do you expect to happen?

#3 Vorel512   Members   -  Reputation: 130

Like
0Likes
Like

Posted 09 May 2012 - 06:49 AM

In Instruments I do not see any memory drop.
Even if I remove a lot of textures.

Maybe it is because I use automatic reference counting.

#4 Brother Bob   Moderators   -  Reputation: 8631

Like
0Likes
Like

Posted 09 May 2012 - 07:17 AM

Strictly speaking, the specification only says that, after deleting a texture object, the object is considered unused. It says nothing that internal resources has to be released. It is possible that internal resources are saved for future textures. If Instruments doesn't inspect the internal states of the OpenGL implementation, it is likely that it cannot differentiate between objects and internal resources.

The only way to determine if the texture is valid is to query the object handle with glIsTexture. But this does not reflect any internal resources which may be what Instruments is reporting.

#5 SaTANO   Members   -  Reputation: 418

Like
0Likes
Like

Posted 09 May 2012 - 03:07 PM

well there is one thing you should try
I assume that you are probably deleting textures in dealloc method...
You should check if you still have working context (this is very important because otherwise you don't have working connection ) and delete textures before releasing context

"OpenGL functions do not work unless an OpenGL context has been created and is active within that thread. Thus, glGenTextures will do nothing before context creation, and glDeleteTextures will do nothing after context destruction."

for more info you should check http://www.opengl.org/wiki/Common_Mistakes part the object oriented Language problem

#6 mhagain   Crossbones+   -  Reputation: 8285

Like
1Likes
Like

Posted 09 May 2012 - 05:19 PM

This is normal behaviour and is nothing to be worried about. The GL spec just specifies that the texture name is free for reuse and that the texture object has neither contents nor dimensionality. It says nothing whatsoever about the memory used for the object. GL implementations are free to keep the memory hanging around for subsequent reuse if necessary, to free it some arbitrary time later, or whatever the driver writer decides is the best behaviour.

Don't expect a glDeleteTextures call to behave like free () or delete in C/C++.

It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#7 DemonRad   Members   -  Reputation: 290

Like
0Likes
Like

Posted 10 May 2012 - 01:41 AM

try to use again that texture. You'll probably see no texture.

And then try to load a new texture with same size, probably you will notice no memory usage increase.

Peace and love, now I understand really what it means! Guardian Angels exist! Thanks!





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS