Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
960:733be18fe140 | 961:92e32e263ae9 |
---|---|
238 void LoaderCache::ClearCache() | 238 void LoaderCache::ClearCache() |
239 { | 239 { |
240 #if ORTHANC_ENABLE_WASM != 1 | 240 #if ORTHANC_ENABLE_WASM != 1 |
241 LockingEmitter::WriterLock lock(lockingEmitter_); | 241 LockingEmitter::WriterLock lock(lockingEmitter_); |
242 #endif | 242 #endif |
243 | |
244 //#ifndef NDEBUG | |
245 // ISO way of checking for debug builds | |
246 DebugDisplayObjRefCounts(); | |
247 //#endif | |
243 seriesVolumeProgressiveLoaders_.clear(); | 248 seriesVolumeProgressiveLoaders_.clear(); |
244 multiframeVolumeLoaders_.clear(); | 249 multiframeVolumeLoaders_.clear(); |
245 dicomVolumeImageMPRSlicers_.clear(); | 250 dicomVolumeImageMPRSlicers_.clear(); |
246 dicomStructureSetLoaders_.clear(); | 251 dicomStructureSetLoaders_.clear(); |
247 } | 252 } |
248 | 253 |
254 | |
255 template<typename T> void DebugDisplayObjRefCountsInMap( | |
256 const std::string& name, const std::map<std::string, boost::shared_ptr<T> >& myMap) | |
257 { | |
258 LOG(TRACE) << "Map \"" << name << "\" ref counts:"; | |
259 size_t i = 0; | |
260 for (const auto& it : myMap) | |
261 { | |
262 auto ptr = it.second; | |
263 LOG(TRACE) << " element #" << i << ": ref count = " << it.second.use_count(); | |
264 i++; | |
265 } | |
266 } | |
267 | |
268 void LoaderCache::DebugDisplayObjRefCounts() | |
269 { | |
270 DebugDisplayObjRefCountsInMap("seriesVolumeProgressiveLoaders_", seriesVolumeProgressiveLoaders_); | |
271 DebugDisplayObjRefCountsInMap("multiframeVolumeLoaders_", multiframeVolumeLoaders_); | |
272 DebugDisplayObjRefCountsInMap("dicomVolumeImageMPRSlicers_", dicomVolumeImageMPRSlicers_); | |
273 DebugDisplayObjRefCountsInMap("dicomStructureSetLoaders_", dicomStructureSetLoaders_); | |
274 } | |
249 } | 275 } |