Hi Maria, Yes, I saw your post about this, and tried this kind of solution. Unfortunately, the problem doesn't arise durung viewing but during data preparation. The viewer isn't realized yet, and the database paging functions are not being processed at this time. Registering to, or clearing the DatabasePager have no effect.
Thanks anyway. Sukender PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/ ----- "María Ten" <[email protected]> a écrit : > Hi Sukender, > > The DatabasePager only update correctly the timestamp of expired > children if they are registered. After load a new PagedLOD with the > fileName, it is registered automatically, but the level 0 PagedLOD is > not registered because you created it manually. Since it is not > registered, the databasepager doesn't update the timestamp for the > expired children of this PagedLOD. So the children are not expired and > they remain in memory. > > You have to call registerPagedLODs(rootNode)[1] after add the PagedLOD > to the scenegraph or call this method with the PagedLOD of level 0 as > parameter to force the DatabasePager to register it. For example: > > osg::ref_ptr<osg::PagedLOD> paged( new osg::PagedLOD ); > paged->addChild(new osg::Node); > paged->setFileName(1, pathTo3DFile); > paged->setRange(0, dist, FLT_MAX); > paged->setRange(1, 0, dist); > viewer.getDatabasePager()->registerPagedLODs(paged.get()); > > We have the same issue in our application and calling this method > works nice for us. > > Cheers, > > Maria. > > [1] OSG Reference to registerPagedLODs method: > http://www.openscenegraph.org/documentation/OpenSceneGraphReferenceDocs/a00163.html#2c20aad9d434a2a2d11b1c5d092d2e59 > > > On Wed, Mar 23, 2011 at 11:54 AM, Laurens Voerman < [email protected] > > wrote: > > > Hi Sukender, > > Your code can't cause the problem I suggested, so it must be something > else. I have no other suggestions to offer. > > Laurens. > > > > > > On 3/23/2011 11:12 AM, Sukender wrote: > > > Hi Laurens, > > Thanks for the tip. But my function looks like: > osg::ref_ptr<osg::PagedLOD> paged( new osg::PagedLOD ); > paged->addChild(new osg::Node); > paged->setFileName(1, pathTo3DFile); > paged->setRange(0, dist, FLT_MAX); > paged->setRange(1, 0, dist); > > I create an empty child at index 0, viewable from 'dist' to FLT_MAX. > The second thing is not a child but a range+filename, viewable from 0 > to 'dist. > This seems correct to me. > > Thoughts? > > Sukender > PVLE - Lightweight cross-platform game engine - > http://pvle.sourceforge.net/ > > ----- "Laurens Voerman"< [email protected] > a écrit : > > > > Hi Sukender, > > Just a guess here, > > when you say > > Generate a PagedLOD, to load 'groupFile' > do you call PagedLOD::addChild(Node *child, ....) ? > > for the pageLOD will then hold the child in memory until > PagedLOD::removeExpiredChildren() is called. Normally this is done in > the frame loop (in updateSceneGraph()) but I think you're not in a > frame > loop (yet). > > Laurens. > > On 3/23/2011 10:19 AM, Sukender wrote: > > > Hi Robert, > > Sorry for being too vague. It's a "data preparation + viewer" app, > but the problem arises during the data preparation. Some data sets do > not present the symptoms whereas some others do... Here is a more > detailed view of the problematic method, in pseudo-code: > > > > void function(Group& parent, const string& path) { > If path is a directory > osg::ref_ptr<osg::Group> group(new osg::Group); > Foreach entry in the directory, do a recursive call: > function(group, entry). > > > write 'group' to disk, in 'groupFile' (somewhere out of the > current directory structure) > > > Generate a PagedLOD, to load 'groupFile' when below a given view > distance (using group->getBound()) > > > Add that PagedLOD to 'parent' > unload the group (well, it's a local variable!) > else if it's a 3D file > Get the AABB of the 3D file (the file isn't loaded in memory) > Generate a PagedLOD, to load the 3D file when below a given view > distance (using AABB info) > > > Add that PagedLOD to 'parent' > } > > This makes memory rise very high and very quickly on a given > dataset. This dataset is a hierarchical tree structure with at most > 1000 3D files in each dir. What is strange is that the algorithm seems > quite straightforward. I'm just going crazy! I'm pretty sure there is > a stupid little thing around here that I didn't spot. Or is there some > OSG internal mechanism I didn't deactivate? > > > > Tries: > - As I told, I wrote (before the method runs) > options = osgDB::Registry::instance()->getOptions(); > options->setBuildKdTreesHint(osgDB::Options::DO_NOT_BUILD_KDTREES); > options->setObjectCacheHint(osgDB::Options::CACHE_NONE); > - I also tried adding "databasePager.clear();" after writing the > 'groupFile', but this doesn't change anything. > > > > Any idea? > Many thanks. > > Sukender > PVLE - Lightweight cross-platform game engine - > http://pvle.sourceforge.net/ > > > > ----- "Robert Osfield"< [email protected] > a écrit : > > > > Hi Sukender, > > You explanation of what you are doing in your app is way too light > for > us to be able to guess what might be amiss. Are you running the > viewer? Is it just data preperation? I haven't got a clue. > > Robert. > > On Tue, Mar 22, 2011 at 5:42 PM, Sukender< [email protected] > wrote: > > > Hi all, > > Here's something strange: > - I create PageLODs that will load files on disk when needed > - I create Groups of PagedLODs > - I write those groups to disk (OSGB/T format). They thus contain > only few data (just nodes and paths where data is). > > > - I create a PagedLOD which loads this newly file on disk. The > group > > > > > is theorically unloaded after this. > > > > When repeating this, my memory usage climbs very high... but the > groups should not be in memory... I wrote > > > osgDB::Options * options = > osgDB::Registry::instance()->getOptions(); > > > > > options->setBuildKdTreesHint(osgDB::Options::DO_NOT_BUILD_KDTREES); > > > > > > > options->setObjectCacheHint(osgDB::Options::CACHE_NONE); > But this doesn't change anything. > And of course I finally run out of memory. > For info, small graphs behave normally in osgViewer (nodes load > when > > > > > approaching, memory usage rises, etc.). > > > > Any idea? > Thanks. > > Sukender > PVLE - Lightweight cross-platform game engine - > http://pvle.sourceforge.net/ > > > _______________________________________________ > osg-users mailing list > [email protected] > > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > > > > > _______________________________________________ > osg-users mailing list > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > _______________________________________________ > osg-users mailing list > [email protected] > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > > -- > María Ten Rodríguez > > gvSIG 3D Blog: > http://gvsig3d.blogspot.com > > Instituto de Automática e Informática Industrial http://www.ai2.upv.es > Ciudad Politécnica de la Innovación > Universidad Politécnica de Valencia > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

