MCPcopy Create free account
hub / github.com/Kitware/VTK / PruneUnusedObjects

Method PruneUnusedObjects

Serialization/Manager/vtkObjectManager.cxx:561–602  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

559
560//------------------------------------------------------------------------------
561void vtkObjectManager::PruneUnusedObjects()
562{
563 // Find strong objects not referenced by states
564 vtkMarshalContext::StrongObjectStore staleStrongObjects;
565 for (const auto& iter : this->Context->StrongObjects())
566 {
567 for (const auto& object : iter.second)
568 {
569 auto identifier = this->Context->GetId(object);
570 auto key = vtk::to_string(identifier);
571 if (!this->Context->States().contains(key))
572 {
573 staleStrongObjects[iter.first].insert(object);
574 }
575 }
576 }
577 for (auto& iter : staleStrongObjects)
578 {
579 for (const auto& object : iter.second)
580 {
581 vtkVLog(this->GetObjectManagerLogVerbosity(),
582 << "Remove stale strong object: " << iter.first << ":" << object);
583 this->Context->Retire(iter.first, object);
584 }
585 }
586 staleStrongObjects.clear();
587 // Clear out stale weak references to objects
588 std::vector<vtkTypeUInt32> staleIds;
589 staleIds.reserve(this->Context->WeakObjects().size());
590 for (const auto& iter : this->Context->WeakObjects())
591 {
592 if (iter.second == nullptr)
593 {
594 staleIds.emplace_back(iter.first);
595 vtkVLog(this->GetObjectManagerLogVerbosity(), << "Remove stale object: " << iter.first);
596 }
597 }
598 for (const auto& identifier : staleIds)
599 {
600 this->Context->UnRegisterObject(identifier);
601 }
602}
603
604//------------------------------------------------------------------------------
605void vtkObjectManager::PruneUnusedBlobs()

Callers 3

Calls 11

RetireMethod · 0.80
to_stringFunction · 0.50
GetIdMethod · 0.45
containsMethod · 0.45
insertMethod · 0.45
clearMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
emplace_backMethod · 0.45
UnRegisterObjectMethod · 0.45

Tested by

no test coverage detected