memory leak

Hello,

I’m trying to figure out where I have memory leak in my program. In order to do that, I changed my config.prc file to disable Panda3D cache by adding these lines:

transform-cache 0
state-cache 0
geom-cache-size 0
released-vbuffer-cache-size 0
released-ibuffer-cache-size 0

Then, when launching my software, I have seen something strange. The memory usage wasn’t stable. It was always increasing. I looked for the cause, and it seems that the cause were some meshes.

Then I loaded one of the mesh in pview and, indeed, in pstats I saw the memory usage also increasing. In particular it’s System memory:MMap:NeverFree:Active:pmap.

When I remove the lines about the cache in my config file, the memory usage is normal.

So, is it normal ? Is it a bug ?

For your information, I’m using Panda3D 1.6.2 on ubuntu.

To reproduce it, you just have to open the mesh with pview and then move it (cause if the camera does not move, the memory does not seem to increase)

The mesh can be downloaded here : http://db.tt/Vp9RmJe

Also, is there a way to find and list all “Panda objects” that are still not freed ? Cause I tried the MemoryUsage object but it seems it only list the “panda objects” which are still in the scene graph, not the one which are not here anymore but are not freed for an unknown reason.

Thanks in advance.

How much is the apparent leak? The “pmap” category just represents the use of STL structures, and it’s possible that STL has its own internal cache-based allocation scheme beyond Panda’s control. However, any “leaks” from that sort of thing would necessarily be small, and ultimately bounded.

MemoryUsage does indeed list all outstanding Panda objects, not just the ones attached to the scene graph. Of course, you have to set “track-mem-usage 1” to enable it.

David

With this sample, by moving it quickly I have a leak of 1Mo each 5/10 seconds.
But in my software, with a lots of objects, it increased very quickly (around 1 Mo each second).

Hmm, it does appear that something is wrong there, but only when state-cache is disabled. I am investigating further.

David