Mercurial > hg > orthanc-stone
diff Framework/Loaders/LoaderCache.cpp @ 961:92e32e263ae9 toa2019082601
Removed log in IsContextLost (too many calls) + removed glGetError guards on calls (expensive) + added shared_ptr ref count dump in LoaderCache (still needs to figure that one out)
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Mon, 26 Aug 2019 11:01:53 +0200 |
parents | 86ac61a040c9 |
children | d358593820b8 |
line wrap: on
line diff
--- a/Framework/Loaders/LoaderCache.cpp Fri Aug 23 15:02:42 2019 +0200 +++ b/Framework/Loaders/LoaderCache.cpp Mon Aug 26 11:01:53 2019 +0200 @@ -240,10 +240,36 @@ #if ORTHANC_ENABLE_WASM != 1 LockingEmitter::WriterLock lock(lockingEmitter_); #endif + +//#ifndef NDEBUG + // ISO way of checking for debug builds + DebugDisplayObjRefCounts(); +//#endif seriesVolumeProgressiveLoaders_.clear(); multiframeVolumeLoaders_.clear(); dicomVolumeImageMPRSlicers_.clear(); dicomStructureSetLoaders_.clear(); } + + template<typename T> void DebugDisplayObjRefCountsInMap( + const std::string& name, const std::map<std::string, boost::shared_ptr<T> >& myMap) + { + LOG(TRACE) << "Map \"" << name << "\" ref counts:"; + size_t i = 0; + for (const auto& it : myMap) + { + auto ptr = it.second; + LOG(TRACE) << " element #" << i << ": ref count = " << it.second.use_count(); + i++; + } + } + + void LoaderCache::DebugDisplayObjRefCounts() + { + DebugDisplayObjRefCountsInMap("seriesVolumeProgressiveLoaders_", seriesVolumeProgressiveLoaders_); + DebugDisplayObjRefCountsInMap("multiframeVolumeLoaders_", multiframeVolumeLoaders_); + DebugDisplayObjRefCountsInMap("dicomVolumeImageMPRSlicers_", dicomVolumeImageMPRSlicers_); + DebugDisplayObjRefCountsInMap("dicomStructureSetLoaders_", dicomStructureSetLoaders_); + } }