Glgsg: out of memory


I am having issues where two different users are having the same GL out of memory issues. The game crashes with the windows “stopped working” message. In the output it alternates between 2 similar errors:

:display:gsg:glgsg(error): at 6522 of c:\panda3d\panda\src\glstuff\glGraphicsStateGuardian_src.cxx : out of memory


:display:gsg:glgsg(error): at 6333 of c:\panda3d\panda\src\glstuff\glGraphicsStateGuardian_src.cxx : out of memory

I suspect there is some sort of leak in my application. What are some things I could look at? Is it even supposed to crash outright if it runs out of graphics memory? Is there some kind of mechanism I could use to see which models are in memory, or something similar?


I would look at PStats, which will give insight into memory consumption and some detail about it as well.

The graphs there are very interesting, but I don’t see a way to “drill-down” to individual types/model name, so even though I see the graph growing, I don’t see a way to see what’s not getting cleaned up…

You can see at least some of that via DirectTools, if I recall correctly.

It can be activated by including the following in your “.prc” file or (presumably) via loadPrcFileData:

want-directtools  #t
want-tk           #t

If called for, you may find the following useful:

tk-frame-rate 200

See this manual page for more details.

I already checked and made sure nothing extra is left over that is parented to render or hidden before the next zone is loaded. (I also checked in direct tools but as far as I could find I can only see the hierarchy under the render node) Are there any other “root” nodes that contribute to graphics memory usage? Or do any and all loaded models get stored in “graphics” memory? Is there a way to list everything in graphics memory? @rdb If not, what would be some approaches to implement something like that?

One thought: It might be worth checking that you don’t have one or more circular references somewhere that are preventing certain elements from being fully cleaned up, even if they’re removed from the scene-graph.

(In all fairness, I don’t know whether such elements might in fact remain in graphics memory after removal from the graph; but it seems worth mentioning as a possible source for a memory leak.)

There might be ways to show what’s in graphics memory in Panda, but I’m not quite sure off the top of my head. External programs, like RenderDoc, may also possibly be used to do this.