Hi Robert, > It's a bit of long shot, but you could have a look at what the > osgUtil::Optimizer is doing with the data, perhaps OSG-2.x is being > more conservative with collapsing "duplicate" state.
Thanks, precious hint. I've just finished diff'ing the log messages emitted by osgUtil::Optimizer, and I've found the problem: duplicate state attributes aren't being shared because their data variance is marked as UNSPECIFIED, whereas the optimizer expects it to be STATIC in order to perform state sharing. The UNSPECIFIED state didn't even exist in OSG 1.2. :-) The obvious fix in my application is to add a STATIC_OBJECT_DETECTION flag to the Optimizer, but it's not enough. It seems that StateSet::computeDataVariance() only changes attributes' variance from UNSPECIFIED to DYNAMIC if they have any callbacks; but if they have no callbacks, then their variance is left unchanged. Is this a bug? In StateSet::computeDataVariance(), changing the code: if (itr->second.first->getDataVariance()==UNSPECIFIED && (itr->second.first->getUpdateCallback() || itr->second.first->getEventCallback())) { itr->second.first->setDataVariance(DYNAMIC); } to: if (itr->second.first->getDataVariance()==UNSPECIFIED && (itr->second.first->getUpdateCallback() || itr->second.first->getEventCallback())) { itr->second.first->setDataVariance(DYNAMIC); } else // <----- ADDED this block { itr->second.first->setDataVariance(STATIC); } (and similarly for texture attributes) seems to bring memory usage back to normal. Is this an acceptable fix? BTW, performance is still slightly lower than expected. I think this has to do with extended thread safety as you suggested, because my app is already CPU-bound. Not a great issue though, at least if compared to running out of memory. Cheers, Marco _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org