[osg-users] Reference Count too high and memory not being freed

Julien Valentin julienvalentin51 at gmail.com
Sat Apr 21 12:03:07 PDT 2018


Hi,
I personnally don't have big experience with osgearth but I think we can't help you with such a little description of your problem...Where do you call the provided code? In an UpdateCallback?
Perhaps the best for all would be you try to reproduce the issue in a short example to make the potential bug easier to diagnose...
Cheers


adrianj wrote:
> Hello,
> 
> I am add a layer to my scene using osgEarth. I am using a ref_ptr but when I come to remove the layer I find that my ref_ptr is in the 1000's. It looks like it goes up everytime I call frame().
> 
> Why would this be?
> 
> 
> Code:
> 
> /* Adding the layer */
> 
> osg::ref_ptr<ImageLayer> imageryLayer = NULL;
> TMSOptions tmsOptImg;
> tmsOptImg.url() = url;
> imageryLayer = new ImageLayer(name, tmsOptImg);
> _map->addImageLayer(imageryLayer);
> 
> 
> Only thing that runs in between is frame() from a different thread
> 
> /* Removing Layer */
> 
> osg::ref_ptr<ImageLayer> layer = _map->getImageLayerByName(name);
> int count = layer->referenceCount(); /***** REF COUNT IS VERY HIGH *****/
> _map->removeImageLayer(layer);
> 
> 
> 
> 
> Am I doing something wrong? 
> 
> Can somebody please explain or give me some suggestions to try?
> 
> Many thanks for your help!!
> 
> Adrian
> [/code]


------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=73476#73476







More information about the osg-users mailing list