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 

Memory problems in Windows/Visual Studio


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


Joined: 18 Apr 2018
Posts: 3

PostPosted: Thu Apr 19, 2018 3:20 pm    Post subject:
Memory problems in Windows/Visual Studio
Reply with quote

Hi,

I'm just getting started with OpenSceneGraph and just working through some basic examples. I'm running Windows 10 and using Visual Studio 17. I'm building everything using x64.

The problem occurs any time I use a ref_ptr. All the examples I've run work properly until exiting the application, when I get a deallocation error.

I have attached my source code, the OSG debug output, and a screenshot of the error message.

It seems like I have a setting wrong or maybe missed something when I configured OSG when installing it. Does anyone have any ideas about where to start debugging this?

Thank you!

Mark
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12127

PostPosted: Thu Apr 19, 2018 3:33 pm    Post subject:
Memory problems in Windows/Visual Studio
Reply with quote

HI Mark,

This is pretty odd, ref_ptr<> is pretty well tested over the years
(it's not far off two decades old now Smile and is widely used under
Windows and all other platforms by many thousands of developers. So
there has to be something astray with your setup. How did you
configure the OSG when you built it?

What happens when you don't use your LogFileHandler?

Also what version of the OSG are you using?

Does this happen when using standard OSG example like osgviewer?

Robert.

On 19 April 2018 at 16:20, Mark Jablin <> wrote:
Quote:
Hi,

I'm just getting started with OpenSceneGraph and just working through some basic examples. I'm running Windows 10 and using Visual Studio 17. I'm building everything using x64.

The problem occurs any time I use a ref_ptr. All the examples I've run work properly until exiting the application, when I get a deallocation error.

I have attached my source code, the OSG debug output, and a screenshot of the error message.

It seems like I have a setting wrong or maybe missed something when I configured OSG when installing it. Does anyone have any ideas about where to start debugging this?

Thank you!

Mark

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




Attachments:
http://forum.openscenegraph.org//files/error_209.jpg
http://forum.openscenegraph.org//files/main_675.cpp
http://forum.openscenegraph.org//files/output_686.txt





------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
markja
Newbie


Joined: 18 Apr 2018
Posts: 3

PostPosted: Thu Apr 19, 2018 7:08 pm    Post subject:
Reply with quote

Robert,

Well, now I'm totally confused about how I convinced myself that it was the ref_ptr that was causing the problem, as removing the LogFileHandler solves the problem.

I'll see if I can figure out what's going on there. Thanks for the help!

Mark
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12127

PostPosted: Thu Apr 19, 2018 7:15 pm    Post subject:
Memory problems in Windows/Visual Studio
Reply with quote

Hi Mark,

On 19 April 2018 at 20:08, Mark Jablin <> wrote:
Quote:
Well, now I'm totally confused about how I convinced myself that it was the ref_ptr that was causing the problem, as removing the LogFileHandler solves the problem.

I'll see if I can figure out what's going on there. Thanks for the help!

Could you share the LogFileHandler implementation? This might enable
others to test a complete application and spot the cause of the
problem.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
robertosfield
OSG Project Lead


Joined: 18 Mar 2009
Posts: 12127

PostPosted: Thu Apr 19, 2018 7:18 pm    Post subject:
Memory problems in Windows/Visual Studio
Reply with quote

Hi Mark,

One thing you could try with your application is to replace the line:


return viewer.run();

With


int result = viewer.run();
osg::setNotifyHandler(0);
return result;

Robert.


On 19 April 2018 at 20:15, Robert Osfield <> wrote:
Quote:
Hi Mark,

On 19 April 2018 at 20:08, Mark Jablin <> wrote:
Quote:
Well, now I'm totally confused about how I convinced myself that it was the ref_ptr that was causing the problem, as removing the LogFileHandler solves the problem.

I'll see if I can figure out what's going on there. Thanks for the help!

Could you share the LogFileHandler implementation? This might enable
others to test a complete application and spot the cause of the
problem.

Robert.


------------------
Post generated by Mail2Forum
Back to top
View user's profile Send private message
markja
Newbie


Joined: 18 Apr 2018
Posts: 3

PostPosted: Thu Apr 19, 2018 7:33 pm    Post subject:
Reply with quote

Robert,

That doesn't solve the problem.

My log file handler:

Code:
class LogFileHandler : public osg::NotifyHandler
{
public:
   LogFileHandler(const std::string& file)
   {
      m_log.open(file.c_str());
   }
   virtual ~LogFileHandler() { m_log.close(); }
   virtual void notify(osg::NotifySeverity severity,
      const char* msg)
   {
      m_log << msg;
   }
protected:
   std::ofstream m_log;
};


I took that out of OpenSceneGraph 3.0 Beginner's Guide.

I'm using OSG 3.4.1.

Thanks for your help.

Mark
Back to top
View user's profile Send private message
Voerman, L.
Guest





PostPosted: Fri Apr 20, 2018 7:17 am    Post subject:
Memory problems in Windows/Visual Studio
Reply with quote

I suspect you are mixing debug and release builds.Basic guess is that you build osg in release and are trying to run a debug build of your main application. Try a release or RelWithDebinfo build.
Regards, Laurens.


On Thu, Apr 19, 2018 at 9:33 PM, Mark Jablin < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Robert,

That doesn't solve the problem.

My log file handler:


Code:
class LogFileHandler : public osg::NotifyHandler
{
public:
   LogFileHandler(const std::string& file)
   {
      m_log.open(file.c_str());
   }
   virtual ~LogFileHandler() { m_log.close(); }
   virtual void notify(osg::NotifySeverity severity,
      const char* msg)
   {
      m_log << msg;
   }
protected:
   std::ofstream m_log;
};



I took that out of OpenSceneGraph 3.0 Beginner's Guide.

I'm using OSG 3.4.1.

Thanks for your help.

Mark

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




------------------
Post generated by Mail2Forum
Back to top
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 Problems porting from osg-3.4.0 to os... hvarma General 10 Wed Sep 12, 2018 3:29 pm View latest post
No new posts problems with osg-3.4.0 port to osg-3... Herman Varma General 4 Wed Sep 12, 2018 2:26 pm View latest post
No new posts GL profiles issues on Windows Riccardo Corsi General 11 Tue Sep 04, 2018 8:46 pm View latest post
No new posts Drawable - recent commit causing prob... gwaldron General 3 Thu Aug 30, 2018 12:19 pm View latest post
No new posts Cross-platform examples for Linux, ma... kornerr Announcement [ANN] 6 Tue Aug 14, 2018 10:51 am 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