Robert Osfield schrieb:
Hi Chris,

The use of the osgpick main in this way is pretty atypical.  If you
want to just do intersection testing then you don't need to bring the
app up.  Do you need a viewer to come up?

Anyway, you might want to try out the development releases 1.9.x of
the OSG or the SVN version as there is new viewer library that does
handle clean up of OpenGL more robustly than the old Producer based
osgProducer::Viewer.

Hi,

the examples don´t use ref_ptrs consequently as they are only thought as "little examples" (Robert, correct me if I´m wrong, but those little leaks don´t matter if those objects are created only once, I think)

. For instance, in create HUD:

osg::Node* createHUD(osgText::Text* updateText)
{

   // create the hud. derived from osgHud.cpp
// adds a set of quads, each in a separate Geode - which can be picked individually
   // eg to be used as a menuing/help system!
   // Can pick texts too!

   osg::Camera* hudCamera = new osg::Camera;   ///HERE

...

// turn lighting off for the text and disable depth test to ensure its always ontop.
   osg::Vec3 position(150.0f,800.0f,0.0f);
   osg::Vec3 delta(0.0f,-60.0f,0.0f);
{
       osg::Geode* geode = new osg::Geode();   ///HERE



So if you want to call this repeatedly you will have to convert those to ref_ptr, i.e. osg::ref_ptr<osg::Camera> hudCamera = new osg::Camera and so on.

If you use the svn version and make those changes your memory-leaks should go away.

Regards,

Andreas


Robert.

On 4/25/07, Chris and Heather Kosek <[EMAIL PROTECTED]> wrote:


Robert,

I am using version osg 1.2 on Red Hat Linux Enterprise 4. I am using "top" or System Monitor to monitor the growth in how much memory is being used.

I have a test case where my driver calls the routine osgpick, which is a
modified osgpick.cpp where the main was changed to osgpick.

After the viewer comes up, I hit escape which causes the viewer to go away
and return to the driver.  The driver then sleeps for 3 seconds so I can
check if the memory usage has change and it hasn't, it is still ~90mb. I then call osgpick again and the memory usage grows by ~80mb. In the driver
below you'll see what my test is:

#include "osgpick.h"
#include <stdio.h>

int main( int argc, char **argv )
{

    int returnValue;

    returnValue = osgpick( argc, argv );
    sleep(3);
    returnValue = osgpick( argc, argv );
    return 0;

}


What I want to do and what OpenSceneGraph is used for may be two different things. The intent of our application was to use OpenSceneGraph to view a 3d Model of building and to get the x,y,z information on a building model to
place another model.  The position information and normal information is
then passed onto another routine which uses this information. The viewer
was to be initiated after choosing a building to view on a 2d map.   We
would be looking at many different buildings, so the thought was that we
would open and closing the viewer as needed.

I am asking these questions not to accuse OpenSceneGraph of Memory Leaks, but to try and understand if there is something I am doing wrong, or if I
can not use OpenSceneGraph as was initially intended.



Thank you for your response,

Chris Kosek














 ________________________________
 From: "Robert Osfield" <[EMAIL PROTECTED]>
Reply-To: osg users <[email protected]>
To: "osg users" <[email protected]>
Subject: Re: [osg-users] Memory usage keeps growing
Date: Wed, 25 Apr 2007 15:57:28 +0100

>Hi Chris,
>
>The OSG in general doesn't suffer from memory leaks, as memory is
>pretty reliably managed by osg::ref_ptr<>/osg::Referenced support
>for
>ref counting.
>
>You usage model isn't clear to me, and I don't know what OS, version
>of the OSG, version of the viewer classes that you are using, or
>what
>tools you are using which indicate that memory usage is growing.
>
>Robert.
>
>On 4/25/07, Chris and Heather Kosek <[EMAIL PROTECTED]> wrote:
>>
>>
>>Hello,
>>
>>I noticed when I call the osgpick example from a driver the memory
>>used does
>>not go away until the process goes away and not when the viewer
>>goes away.
>>The memory usage grows by ~80 mb each time I call osgpick. There
>>seems to
>>be no cleanup when the viewer closes. Can I use osg in this
>>manner?
>>
>>I am trying to use OpenSceneGraph in the following manner;
>>
>>1. Calling it from another routine (works)
>>
>>2. Passing it an model filename (works)
>>
>>3 Displaying the building model in the viewer (works)
>>
>>4. Getting the x,y,z intersect of a point the wall of the building
>>(works)
>>
>>5. Placing a model at and x,y,z with the model having the proper
>>facing
>>based on the normal (works)
>>
>>6. Return the position and normal information to the calling
>>routine (works)
>>
>>7. Calling routine with x,y & z information of model to place
>>(works)
>>
>>8. Not having memory usage grow each time I call the routine. (
>>My
>>problem).
>>
>>Thank you,
>>
>>Chris Kosek
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>________________________________
>> Don't quit your job – Take Classes Online and Earn your Degree in
>>1 year.
>>Start Today!
>>_______________________________________________
>>osg-users mailing list
>>[email protected]
>>http://openscenegraph.net/mailman/listinfo/osg-users
>>http://www.openscenegraph.org/
>>
>_______________________________________________
>osg-users mailing list
>[email protected]
>http://openscenegraph.net/mailman/listinfo/osg-users
>http://www.openscenegraph.org/

________________________________
Mortgage refinance is Hot. *Terms. Get a 5.375%* fix rate. Check savings
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/




_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to