return 0;
}
+//========================================================================
+//function : OCC27318
+//purpose : Creates a box that is not listed in map of AIS objects of ViewerTest
+//========================================================================
+static Standard_Integer OCC27318 (Draw_Interpretor& /*theDI*/, Standard_Integer /*theArgc*/, const char** theArgv)
+{
+ const Handle(AIS_InteractiveContext)& aCtx = ViewerTest::GetAISContext();
+ if (aCtx.IsNull())
+ {
+ std::cout << "No interactive context. Use 'vinit' command before " << theArgv[0] << "\n";
+ return 1;
+ }
+
+ TopoDS_Shape aBox = BRepPrimAPI_MakeBox (20, 20, 20).Shape();
+ Handle(AIS_Shape) aBoxObj = new AIS_Shape (aBox);
+ aCtx->Display (aBoxObj, Standard_True);
+
+ return 0;
+}
+
void QABugs::Commands_19(Draw_Interpretor& theCommands) {
const char *group = "QABugs";
theCommands.Add ("OCC27065",
"OCC27065 spine profile",
__FILE__, OCC27065, group);
-
+
+ theCommands.Add ("OCC27318",
+ "OCC27318: Creates a box that is not listed in map of AIS objects of ViewerTest",
+ __FILE__, OCC27318, group);
+
return;
}
myHilightDrawer->Link (myDrawer);
}
+//==================================================
+// Function: Destructor
+// Purpose : Clears all selections of the object
+//==================================================
+SelectMgr_SelectableObject::~SelectMgr_SelectableObject()
+{
+ for (Standard_Integer aSelIdx = 1; aSelIdx <= myselections.Length(); ++aSelIdx)
+ {
+ myselections.Value (aSelIdx)->Clear();
+ }
+}
//==================================================
// Function: HasSelection
public:
+ //! Clears all selections of the object
+ Standard_EXPORT virtual ~SelectMgr_SelectableObject();
//! Recovers and calculates any sensitive primitive,
//! aSelection, available in Shape mode, specified by
--- /dev/null
+puts "========"
+puts "OCC27318"
+puts "========"
+puts ""
+##################################################################
+puts "Memory is not released in Select3D_SensitiveSet when destroying AIS_InteractiveContext without removing objects"
+##################################################################
+
+pload VISUALIZATION QAcommands
+
+# to measure initial memory correctly, open and close interactive context
+# to load FreeImage
+vinit
+vclose
+set aMemInit [meminfo h]
+puts "Initial mem: [expr $aMemInit / (1024 * 1024)] MiB ([expr $aMemInit])"
+
+# create a box and display it in each interactive context. The context is
+# the only instance that references to the box. Therefore, the box must be
+# removed completely after each context's closing
+for {set anIter 0} {$anIter < 300} {incr anIter} {
+ vinit
+ OCC27318
+ vclose
+}
+
+set aMemAfter [meminfo h]
+puts "Memory after closing interactive context several times: [expr $aMemAfter / (1024 * 1024)] MiB ([expr $aMemAfter])"
+
+set aRatio [expr $aMemAfter / double($aMemInit)]
+
+# check if the memory difference is greater than 5%
+if [expr $aRatio > 1.05] {
+ puts "Error : TEST FAILED"
+}