2.8 branch: Merge revision 10520 from trunk to fix memory leaks.

This commit is contained in:
Paul MARTZ
2010-03-17 20:47:50 +00:00
parent 4e90ccb13a
commit 7ab4faeae1
7 changed files with 75 additions and 68 deletions

View File

@@ -426,18 +426,21 @@ class OSGDB_EXPORT Registry : public osg::Referenced
* for that object in the cache to specified time.
* This would typically be called once per frame by applications which are doing database paging,
* and need to prune objects that are no longer required.
* Time value is time in seconds.*/
void updateTimeStampOfObjectsInCacheWithExternalReferences(double currentTime);
* The time used is taken from the FrameStamp::getReferenceTime().*/
void updateTimeStampOfObjectsInCacheWithExternalReferences(const osg::FrameStamp& frameStamp);
/** Removed object in the cache which have a time stamp at or before the specified expiry time.
* This would typically be called once per frame by applications which are doing database paging,
* and need to prune objects that are no longer required, and called after the a called
* after the call to updateTimeStampOfObjectsInCacheWithExternalReferences(currentTime).
* Note, the currentTime is not the expiryTime, one would typically set the expiry time
* to a fixed amount of time before currentTime, such as expiryTime = currentTime-10.0.
* Time value is time in seconds.*/
void removeExpiredObjectsInCache(double expiryTime);
* after the call to updateTimeStampOfObjectsInCacheWithExternalReferences(frameStamp).*/
void removeExpiredObjectsInCache(const osg::FrameStamp& frameStamp);
/** set hint to viewer code calling removeExpiredObjectsInCache to specify how long it should give before expiring objects in Registry cache,*/
void setExpiryDelay(double expiryDelay) { _expiryDelay = expiryDelay; }
double getExpiryDelay() const { return _expiryDelay; }
/** Remove all objects in the cache regardless of having external references or expiry times.*/
void clearObjectCache();
@@ -591,6 +594,7 @@ class OSGDB_EXPORT Registry : public osg::Referenced
FilePathList _dataFilePath;
FilePathList _libraryFilePath;
double _expiryDelay;
ObjectCache _objectCache;
OpenThreads::Mutex _objectCacheMutex;

View File

@@ -39,11 +39,12 @@ class OSGVIEWER_EXPORT Scene : public osg::Referenced
osgDB::DatabasePager* getDatabasePager() { return _databasePager.get(); }
const osgDB::DatabasePager* getDatabasePager() const { return _databasePager.get(); }
void setImagePager(osgDB::ImagePager* ip);
osgDB::ImagePager* getImagePager() { return _imagePager.get(); }
const osgDB::ImagePager* getImagePager() const { return _imagePager.get(); }
void updateSceneGraph(osg::NodeVisitor& updateVisitor);
/** Get the Scene object that has the specified node assigned to it.
* return 0 if no Scene has yet been assigned the specified node.*/