mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
0027871: VIS - Possible memory leak in viewers in virtual windows mode
Command checktrend is modified to avoid performing check for lists containing less than 5 items, as estimations based on short lists often lead to false positives. Disable vtkTimerLog within test checking for memory leaks.
This commit is contained in:
@@ -1422,7 +1422,7 @@ proc osutils:vtkCsf {{theOS ""}} {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
set aLibArray [list vtkCommonCore vtkCommonDataModel vtkCommonExecutionModel vtkCommonMath vtkCommonTransforms vtkRenderingCore \
|
set aLibArray [list vtkCommonCore vtkCommonSystem vtkCommonDataModel vtkCommonExecutionModel vtkCommonMath vtkCommonTransforms vtkRenderingCore \
|
||||||
vtkRenderingOpenGL vtkFiltersGeneral vtkIOCore vtkIOImage vtkImagingCore vtkInteractionStyle]
|
vtkRenderingOpenGL vtkFiltersGeneral vtkIOCore vtkIOImage vtkImagingCore vtkInteractionStyle]
|
||||||
|
|
||||||
# Additional suffices for the libraries
|
# Additional suffices for the libraries
|
||||||
|
@@ -2765,13 +2765,14 @@ proc _checkpoint {coord_x coord_y rd_ch gr_ch bl_ch} {
|
|||||||
# the check fails and procedure raises error with specified message.
|
# the check fails and procedure raises error with specified message.
|
||||||
#
|
#
|
||||||
# Otherwise the procedure returns false meaning that more iterations are needed.
|
# Otherwise the procedure returns false meaning that more iterations are needed.
|
||||||
# Note that false is returned in any case if length of listval is less than 3.
|
# Note that analysis is peformed only if listval contains at least 5 values,
|
||||||
|
# thus false is returned unconditionally for shorter lists.
|
||||||
#
|
#
|
||||||
# See example of use to check memory leaks in bugs/caf/bug23489
|
# See example of use to check memory leaks in bugs/caf/bug23489
|
||||||
#
|
#
|
||||||
proc checktrend {listval delta tolerance message} {
|
proc checktrend {listval delta tolerance message} {
|
||||||
set nbval [llength $listval]
|
set nbval [llength $listval]
|
||||||
if { $nbval < 3} {
|
if { $nbval < 5} {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,10 +86,7 @@
|
|||||||
#include <IVtkDraw_Interactor.hxx>
|
#include <IVtkDraw_Interactor.hxx>
|
||||||
|
|
||||||
// prevent disabling some MSVC warning messages by VTK headers
|
// prevent disabling some MSVC warning messages by VTK headers
|
||||||
#ifdef _MSC_VER
|
#include <Standard_WarningsDisable.hxx>
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable: 4244)
|
|
||||||
#endif
|
|
||||||
#include <vtkAlgorithmOutput.h>
|
#include <vtkAlgorithmOutput.h>
|
||||||
#include <vtkAppendPolyData.h>
|
#include <vtkAppendPolyData.h>
|
||||||
#include <vtkBMPWriter.h>
|
#include <vtkBMPWriter.h>
|
||||||
@@ -111,6 +108,7 @@
|
|||||||
#include <vtkRenderWindowInteractor.h>
|
#include <vtkRenderWindowInteractor.h>
|
||||||
#include <vtkSmartPointer.h>
|
#include <vtkSmartPointer.h>
|
||||||
#include <vtkTIFFWriter.h>
|
#include <vtkTIFFWriter.h>
|
||||||
|
#include <vtkTimerLog.h>
|
||||||
#include <vtkWindowToImageFilter.h>
|
#include <vtkWindowToImageFilter.h>
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <X11/X.h>
|
#include <X11/X.h>
|
||||||
@@ -123,9 +121,7 @@
|
|||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <tk.h>
|
#include <tk.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef _MSC_VER
|
#include <Standard_WarningsRestore.hxx>
|
||||||
#pragma warning(pop)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// workaround name conflicts with OCCT methods (in class TopoDS_Shape for example)
|
// workaround name conflicts with OCCT methods (in class TopoDS_Shape for example)
|
||||||
#ifdef Convex
|
#ifdef Convex
|
||||||
@@ -407,6 +403,37 @@ static Standard_Integer VtkInit (Draw_Interpretor& ,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//================================================================
|
||||||
|
// Function : VtkTimerLog
|
||||||
|
// Purpose :
|
||||||
|
//================================================================
|
||||||
|
static Standard_Integer VtkTimerLog (Draw_Interpretor& ,
|
||||||
|
Standard_Integer theNbArgs,
|
||||||
|
const char** theArgVec)
|
||||||
|
{
|
||||||
|
TCollection_AsciiString aVal;
|
||||||
|
if (theNbArgs == 2)
|
||||||
|
{
|
||||||
|
aVal = theArgVec[1];
|
||||||
|
aVal.LowerCase();
|
||||||
|
}
|
||||||
|
if (aVal == "1"
|
||||||
|
|| aVal == "on")
|
||||||
|
{
|
||||||
|
vtkTimerLog::LoggingOn();
|
||||||
|
}
|
||||||
|
else if (aVal == "0"
|
||||||
|
|| aVal == "off")
|
||||||
|
{
|
||||||
|
vtkTimerLog::LoggingOff();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Syntax error: wrong arguments\n";
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : CreateActor
|
// Function : CreateActor
|
||||||
@@ -1173,6 +1200,11 @@ void IVtkDraw::Commands (Draw_Interpretor& theCommands)
|
|||||||
"\n\t\t: Creates the Vtk window",
|
"\n\t\t: Creates the Vtk window",
|
||||||
__FILE__, VtkInit, group);
|
__FILE__, VtkInit, group);
|
||||||
|
|
||||||
|
theCommands.Add("ivtktimerlog",
|
||||||
|
"ivtktimerlog {on|off}\n"
|
||||||
|
"\n\t\t: Enables/disables VTK timer profiler",
|
||||||
|
__FILE__, VtkTimerLog, group);
|
||||||
|
|
||||||
theCommands.Add("ivtkdisplay",
|
theCommands.Add("ivtkdisplay",
|
||||||
"ivtkdisplay usage:\n"
|
"ivtkdisplay usage:\n"
|
||||||
"ivtkdisplay name1 name2 ..."
|
"ivtkdisplay name1 name2 ..."
|
||||||
@@ -1236,7 +1268,6 @@ void IVtkDraw::Commands (Draw_Interpretor& theCommands)
|
|||||||
__FILE__, VtkBackgroundColor, group);
|
__FILE__, VtkBackgroundColor, group);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//================================================================
|
//================================================================
|
||||||
// Function : Factory
|
// Function : Factory
|
||||||
// Purpose :
|
// Purpose :
|
||||||
|
@@ -22,3 +22,4 @@ vtkImagingCore
|
|||||||
vtkInteractionStyle
|
vtkInteractionStyle
|
||||||
vtkRenderingOpenGL
|
vtkRenderingOpenGL
|
||||||
vtkRenderingFreeTypeOpenGL
|
vtkRenderingFreeTypeOpenGL
|
||||||
|
vtkCommonSystem
|
||||||
|
@@ -1,66 +1,46 @@
|
|||||||
puts "For OCC27871: Possible memory leak in viewers in virtual windows mode"
|
|
||||||
puts "For OCC27871: Use 120 kb tolerance for checktrend because of leak on Linux in virtual windows mode"
|
|
||||||
puts "============"
|
puts "============"
|
||||||
puts "OCC27567"
|
puts "0027567: Visualization - possible memory leaks due to use of plain pointers in IVTK"
|
||||||
puts "============"
|
puts "============"
|
||||||
puts ""
|
puts ""
|
||||||
#######################################################################
|
|
||||||
# Visualization - possible memory leaks due to use of plain pointers
|
psphere s 10 15 80
|
||||||
# in IVTK
|
box b1 5 5 -5
|
||||||
#######################################################################
|
box b2 -5 -5 -5
|
||||||
|
ptorus t 10 3
|
||||||
|
compound s b1 b2 t cc
|
||||||
|
unset s
|
||||||
|
unset b1
|
||||||
|
unset b2
|
||||||
|
unset t
|
||||||
|
incmesh cc 1
|
||||||
|
|
||||||
ivtkinit
|
ivtkinit
|
||||||
|
ivtktimerlog 0
|
||||||
|
|
||||||
dlog off
|
proc doCycle { theI } {
|
||||||
# Create i_max number of shapes
|
# display shaded/wireframe
|
||||||
set i_max 15
|
uplevel #0 ivtkdisplay cc
|
||||||
|
uplevel #0 ivtksetdispmode 1
|
||||||
|
uplevel #0 ivtksetdispmode 0
|
||||||
|
|
||||||
set listmem {}
|
# select/unselect
|
||||||
for {set i 1} {${i} <= ${i_max}} {incr i} {
|
uplevel #0 ivtkselect 200 200
|
||||||
|
uplevel #0 ivtkselect 0 0
|
||||||
|
|
||||||
psphere s 10 15 80
|
# highlight/unhighlight
|
||||||
box box1 5 5 -5
|
uplevel #0 ivtkmoveto 200 200
|
||||||
box box2 -5 -5 -5
|
uplevel #0 ivtkmoveto 50 50
|
||||||
ptorus t 10 3
|
|
||||||
|
|
||||||
compound s box1 box2 t b$i
|
# hide and remove
|
||||||
|
uplevel #0 ivtkerase cc
|
||||||
unset s
|
uplevel #0 ivtkremove cc
|
||||||
unset box1
|
|
||||||
unset box2
|
|
||||||
unset t
|
|
||||||
|
|
||||||
|
|
||||||
# Display the j-th shape
|
|
||||||
ivtkdisplay b$i
|
|
||||||
|
|
||||||
# Display shaded
|
|
||||||
ivtksetdispmode 1
|
|
||||||
|
|
||||||
# Display wired
|
|
||||||
ivtksetdispmode 0
|
|
||||||
|
|
||||||
# Select the shape
|
|
||||||
ivtkselect 200 200
|
|
||||||
|
|
||||||
# Deselect the shape
|
|
||||||
ivtkselect 0 0
|
|
||||||
|
|
||||||
# Highlight the shape
|
|
||||||
ivtkmoveto 200 200
|
|
||||||
|
|
||||||
# Unhighlight the shape
|
|
||||||
ivtkmoveto 50 50
|
|
||||||
|
|
||||||
# Hide the shape
|
|
||||||
ivtkerase b$i
|
|
||||||
|
|
||||||
# Remove the shape presentation from memory
|
|
||||||
ivtkremove b$i
|
|
||||||
|
|
||||||
unset b$i
|
|
||||||
|
|
||||||
lappend listmem [meminfo h]
|
|
||||||
checktrend $listmem 0 120000 "Memory leak detected"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Create i_max number of shapes
|
||||||
|
set i_max 15
|
||||||
|
set listmem {}
|
||||||
|
for {set i 1} {${i} <= ${i_max}} {incr i} {
|
||||||
|
doCycle $i
|
||||||
|
lappend listmem [meminfo h]
|
||||||
|
checktrend $listmem 0 1 "Memory leak detected"
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user