[osg-users] Databasepager + multiple views + different camera positions = memory leak?

Michael Bach Jensen michael at ifad.dk
Wed Nov 11 03:54:53 PST 2009

Hi everyone!

This is a tough one. I'm now certain that there is more than one bug at large here! At least one in the pager (the one mentioned in the PagedLOD experts thread) and at least one in the txp plugin.

The one I have been chasing for the past 2 days is within the txp plugin and  looks more like a design issue than a bug. I don't think the txp plugin was designed with multiple cameras in mind!

The TXPNode (the top level node when loading a .txp archive) updates the camera position in _pageManager on every cull visit (through updateEye). Since there is one cull visit per camera per frame, the page manager position jumps between multiple positions every frame. Every time the position changes, the set of LOD0 nodes is reconsidered. This results in multiple cameras fighting over which set of LOD0 nodes should be present. Note that LOD0 nodes, or blocks, become children of the TXPNode in the update stage.

At some point, a state is achieved in which a certain number of nodes end up on the _nodesToAdd list and the same amount of nodes end up on the _nodesToRemove list. Unfortunately, some of the nodes on the remove list are not actually in the _children list, so the net result is that more nodes are added than removed. This happens every frame, so the number of children of the TXPNode increases indefinitely. Since these children are PagedLOD nodes, they, in turn, also start loading in children until all memory is exhausted.

It seems to me as though a major overhaul is needed for the txp plugin to be able to handle multiple cameras. As I mentioned earlier, one workaround is to make sure that each TXPNode is only visited by one camera - for instance by loading the terrain anew for each camera.


Read this topic online here:

More information about the osg-users mailing list