Jump to content
  • Advertisement
Sign in to follow this  
KuJi

OpenGL OpenGL / DevIL

This topic is 3803 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I think i've stumbled upon a memory leak (or im not freeing the resource correctly..) The memory problem occurs here:
	ILuint ilTexture;
	ilGenImages(1, &ilTexture);
	ilBindImage(ilTexture);

	if (ilLoadImage(path))
	{
		// nothing here -- just testing
	}

	ilDeleteImages(1, &ilTexture);
One thing you need to understand is that calling ilLoadImage (without generating / binding the texture) won't cause this. This is the minimum I came up with to reproduce the memory leak. Does this occur to anyone else? Am I not freeing it correctly? :(

Share this post


Link to post
Share on other sites
Advertisement
I'm no expert but I'm presuming each of those function provides a return value for a failure?

Try doing a IlBindImage(0) or equivalent for unbinding the texture and see if the problem still occurs. But no, if the code produces a texture fine in the generate texture phase you shouldn't have that problem.

Also how big a memory leak are you talking about and how are you tracking it?

Jamie

Share this post


Link to post
Share on other sites
The current image is not deleted until it is unbound (i.e. either zero or another image is bound). That may show up as a temporary memory leak, but you need to be more specific about this leak.

Share this post


Link to post
Share on other sites
Quote:
Original post by swiftcoder
The current image is not deleted until it is unbound (i.e. either zero or another image is bound). That may show up as a temporary memory leak, but you need to be more specific about this leak.


I've waited about 2-5 minutes and nothing has shown to fix this. Problem is, when using SDL and resizing -- I went to go use the function to reload all the graphics back to opengl, and noticed this.

Quote:
Original post by Neutrinohunter
I'm no expert but I'm presuming each of those function provides a return value for a failure?

Try doing a IlBindImage(0) or equivalent for unbinding the texture and see if the problem still occurs. But no, if the code produces a texture fine in the generate texture phase you shouldn't have that problem.

Also how big a memory leak are you talking about and how are you tracking it?

Jamie


I watch it via control-alt-delete when resizing. And I'll try that.

*Edit* No, it still occurs -- and depending on how many graphics were loaded, it could be a couple mb per resize.

Share this post


Link to post
Share on other sites
Quote:
Original post by KuJi
I watch it via control-alt-delete when resizing. And I'll try that.

*Edit* No, it still occurs -- and depending on how many graphics were loaded, it could be a couple mb per resize.


You mean the task manager? That`s not a good way to know if there is a leak or not. The compiler will tell you if you have a leak or you need to use a 3rd party tool.

Share this post


Link to post
Share on other sites
Quote:
Original post by V-man
You mean the task manager? That`s not a good way to know if there is a leak or not. The compiler will tell you if you have a leak or you need to use a 3rd party tool.


Well seeing the memory climb 20 mb because the game is resized is definitely a problem <.<.

Share this post


Link to post
Share on other sites
I agree with V-Man, its the not best way but one can generally acertain massive leaks in a program with a Task Manager. I once got my code to go up to around 500,000k within Windows then crash the OS when I forgot to clear something up so it is possible to track with it.

I generally error on the side of its your code unless proven otherwise, even though recently I have proved various bugs within the QT rendering library.

Post the whole source so one of us can compile it, there could be a million different reasons for the problem.

Neutrinohunter

Share this post


Link to post
Share on other sites
I'll draw some code up that requires sdl / openil to show the bug shortly.. just going to throw it in one file though so :(

Share this post


Link to post
Share on other sites
Every resize consumes 20MB?
It would be weird if DevIL had an obvious bug. I`ve been using it for a long time.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!