Open GL memory leak


#1

Hi there,

I've been building a 3D interface using Juce's OpenGL classes and have noticed the memory usage continuously climbs about 1mb a minute. (using task manager in Windows 7)

I checked out the Juce demo (latest tip) and it also does this. (debug especially, retail as well but seemingly slower) 

I'll keep having a look in case I can track it down but I thought I'd let you know because you'd no doubt have a better idea where to look.

 

*edit:  To clarify, it's only when the GL demo is showing.


#2

Sigh.. Developers, please stop treating task manager as a debugging tool. It really isn't designed for that purpose!

Staring at the overall memory use and hoping to deduce anything from that about particular bits of your app is just not a wise way to spend your time. I'm not saying there isn't a leak in the GL demo. Maybe there is. But the fact that a number in task manager goes up is NOT evidence of anything - there are way too many other factors involved in those numbers to be able to make a causal link! Fragmentation, wierd by the internal GL subsystem, virtual memory layouts changing, etc etc.

I'm not on a PC right now, but quickly running the GL demo in a proper debugging tool in Xcode shows that there are no actual leaks at the C++ level. That doesn't mean that something in the Windows GL system (or the GL driver) isn't leaking internally, but debugging that would involve finding some kind of low-level GL profiling tool, and I don't have time to dive into that right now..


#3

I also think there is a leak in openGL, but not on Mac. I have tested with Linux and Android - both have leaks at 2d component rendering and get out of memory after a time X - X is depending on the number of redraws. But on Mac is everything fine.

It must be a pod type or a class without leak detector - the instance counter is stable but we eat a lot of mem.

I have to check a bit more, not sure which profiler I should use on linux - valgrinds output I have to lean to understand before.

 

EDIT: in software rendering everything is fine on linux and android.


#4

I recently got a new laptop running Windows 8 and the same code that chewed through memory on Win 7 in my first post now doesn't seem to do that anymore.  Just to add to the mystery... :D  I haven't really looked any deeper into it though.