OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Reference Count too high and memory not being freed


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
adrianj
Newbie


Joined: 19 Jan 2018
Posts: 14

PostPosted: Sat Apr 21, 2018 3:09 am    Post subject:
Reference Count too high and memory not being freed
Reply with quote

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]
Back to top
View user's profile Send private message
mp3butcher (Julien Valentin)
Appreciator


Joined: 17 Feb 2010
Posts: 475
Location: France

PostPosted: Sat Apr 21, 2018 7:02 pm    Post subject:
Re: Reference Count too high and memory not being freed
Reply with quote

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]
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts How to track down memory leaks? OmegaDoom General 9 Wed Jul 11, 2018 1:07 pm View latest post
No new posts Leaking memory on node removal Tini General 1 Fri May 25, 2018 6:48 pm View latest post
No new posts Leaking memory on node removal Tini General 0 Fri May 25, 2018 6:39 pm View latest post
No new posts Leaking memory on node removal Tini General 0 Fri May 25, 2018 6:30 pm View latest post
No new posts Leaking memory on node removal Tini General 0 Fri May 25, 2018 6:27 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP