On 10/9/06, Sinisa Popovic <[EMAIL PROTECTED]
> wrote:
This is a blind shot; don't know if it will work for you, but it did for me withthe same problem when loading a Terrapage TXP archive viaosgDB::readNodeFile(). See if this code prevents memory climbing.while(1)
{
{
const std::string constantfilename = "const.osga";
osg::ref_ptr<osgDB::Archive> archive2 =
openArchive(constantfilename, osgDB::Archive::CREATE);osgDB::Registry::instance()->clearArchiveCache();
}
// In case of a debug build use "osgdb_osgad.dll".
osgDB::Registry::instance()->closeLibrary("osgdb_osga.dll");
}Note:
I added extra scoping due to experiencing a crash on scope exitwhen my osg::Node (TXPNode) was trying to delete itself afterthe TXP library was closed. Might not be relevant for you.Best regards,Sinisa
Thanks for the tip. I tried your suggestion but it didn't seem to make a difference. I'm using Visual Studio 2005 on XP Pro. Here are some stats:
Virtual memory @ startup:
143,400 MB
Physical Working set
110,736 MB
I ran the code below 500,000 times and the stats were:
Virtual memory:
157,736 MB
Physical Working set
118,576 MB
The numbers were the same if I left the closelibrary call in or not.
It's a small amount of memory difference, but could add up to significant amounts over the lifetime of a process. Oh well, I'll debug this more later.
int count = 0;
while(1)
{
count++;
{
const std::string constantfilename = "const.osga";
osg::ref_ptr<osgDB::Archive> archive2 = openArchive(constantfilename,
osgDB::Archive::CREATE);
osgDB::Registry::instance()->clearArchiveCache();
}
osgDB::Registry::instance()->closeLibrary("osgdb_osga.dll");
if(!(count % 10000))
printf("%d\n",count);
}
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
