Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
VTK
VTK
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 581
    • Issues 581
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 162
    • Merge Requests 162
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • VTK
  • VTKVTK
  • Issues
  • #18116

Closed
Open
Opened Feb 05, 2021 by Thomas Caissard@thomas.caissardDeveloper

Fix unnecessary heap allocations

This issue tracks various places where we could improve memory management.

  • Filters/Core/vtkQuadricClustering.cxx:1407
  • Filters/Core/vtkArrayCalculator.cxx:776
  • Filters/Core/vtkArrayCalculator.cxx:864
  • IO/EnSight/vtkEnSight6DBinaryReader.cxx
  • IO/EnSight/vtkEnSightGoldReader.cxx
  • IO/Xdmf3/vtkXdmf3Reader.cxx
  • Views/Infovis/vtkParallelCoordinatesRepresentation.cxx:979
  • Interactions/Widgets/Testing/Cxx/TestContourWidget2.cxx:77
  • Common/DataModel/vtkExplicitStructuredGrid.cxx:296
  • Interaction/Style/vtkInteractorStyleTrackballActor.cxx:277
  • Interaction/Style/vtkInteractorStyleTrackballActor.cxx:355
  • Interaction/Style/vtkInteractorStyleJoystickActor.cxx:269
  • Interaction/Style/vtkInteractorStyleJoystickActor.cxx:352
  • Filters/Modeling/vtkLoopSubdivisionFilter.cxx:52
  • Filters/Modeling/vtkButterflySubdivisionFilter.cxx:52
  • Filters/General/vtkVoxelContoursToSurfaceFilter.cxx:36
  • Common/DataModel/vtkKdNode.cxx:735
  • Common/Core/vtkMath.cxx:974
  • Common/Core/vtkMath.cxx:1066
  • Common/Core/vtkMath.cxx:1143
  • Common/DataModel/vtkReebGraph.cxx:1043

For reference rg "new (\w)+\[[0-9]+\]"

Common/Core/Testing/Cxx/TestVariantArray.cxx
206:  vtkVariant* userArray = new vtkVariant[3000];

Common/Core/Testing/Cxx/UnitTestMath.cxx
2665:    m[i] = new double[1];
2669:    x[i] = new double[2];
2680:    y[i] = new double[1];
2760:    m[i] = new double[1];
2764:    x[i] = new double[2];
2765:    y[i] = new double[1];

Common/Core/vtkMath.cxx
1135:      hmt[j] = new double[1];

Common/Core/vtkTimePointUtility.cxx
419:  char* copy = new char[25];

Common/DataModel/vtkReebGraph.cxx
1043:  entry.NodeTable = new vtkIdType[1];

Common/DataModel/vtkExplicitStructuredGrid.cxx
300:    extent = new int[6];

Common/DataModel/vtkKdTree.cxx
4211:    double* bounds = new double[6];

Common/DataModel/vtkKdNode.cxx
740:    cellBounds = new double[6];

Common/DataModel/vtkPointsProjectedHull.cxx
632:  double* insidePt = new double[2];

Common/DataModel/Testing/Cxx/otherColorTransferFunction.cxx
85:  char* cData = new char[128];
87:  short* sData = new short[128];
89:  int* iData = new int[128];
91:  long* lData = new long[128];
93:  float* fData = new float[128];
94:  double* dData = new double[128];

Common/DataModel/Testing/Cxx/TestPentagonalPrism.cxx
301:  double* derivs = new double[3];
399:    double* point = new double[3];
408:    double* tCenter = new double[3];
416:      double* above = new double[3];
429:    double* eCenter = new double[3];
441:    double* fCenter = new double[3];
453:    double* outside = new double[3];

Views/Infovis/vtkParallelCoordinatesRepresentation.cxx
979:      vtkIdType* ptIds = new vtkIdType[4];

IO/Legacy/vtkDataWriter.cxx
80:  this->Header = new char[257];
93:  this->LookupTableName = new char[13];
96:  this->FieldDataName = new char[10];
1058:  char* outputFormat = new char[10];

IO/EnSight/vtkEnSightGoldReader.cxx
1797:      nodeIds = new vtkIdType[1];
1858:      nodeIds = new vtkIdType[2];
1859:      intIds = new int[2];
1892:      intIds = new int[2];
1914:      nodeIds = new vtkIdType[3];
1915:      intIds = new int[3];
1950:      intIds = new int[2];
2063:      nodeIds = new vtkIdType[3];
2064:      intIds = new int[3];
2097:      nodeIds = new vtkIdType[6];
2098:      intIds = new int[6];
2142:      intIds = new int[3];
2166:      nodeIds = new vtkIdType[4];
2167:      intIds = new int[4];
2200:      nodeIds = new vtkIdType[8];
2201:      intIds = new int[8];
2245:      intIds = new int[4];
2412:      nodeIds = new vtkIdType[4];
2413:      intIds = new int[4];
2446:      nodeIds = new vtkIdType[10];
2447:      intIds = new int[10];
2492:      intIds = new int[4];
2516:      nodeIds = new vtkIdType[5];
2517:      intIds = new int[5];
2551:      nodeIds = new vtkIdType[13];
2552:      intIds = new int[13];
2598:      intIds = new int[5];
2623:      nodeIds = new vtkIdType[8];
2624:      intIds = new int[8];
2659:      nodeIds = new vtkIdType[20];
2660:      intIds = new int[20];
2708:      intIds = new int[8];
2735:      nodeIds = new vtkIdType[6];
2736:      intIds = new int[6];
2773:      nodeIds = new vtkIdType[15];
2774:      intIds = new int[15];
2820:      intIds = new int[6];

IO/EnSight/vtkEnSight6BinaryReader.cxx
2096:      nodeIds = new vtkIdType[1];
2129:      nodeIds = new vtkIdType[2];
2170:      nodeIds = new vtkIdType[2];
2220:      nodeIds = new vtkIdType[3];
2287:      nodeIds = new vtkIdType[4];
2355:      nodeIds = new vtkIdType[4];
2422:      nodeIds = new vtkIdType[5];
2489:      nodeIds = new vtkIdType[8];
2556:      nodeIds = new vtkIdType[6];

IO/EnSight/vtkEnSightGoldBinaryReader.cxx
2961:      nodeIds = new vtkIdType[1];
3012:      nodeIds = new vtkIdType[2];
3065:      nodeIds = new vtkIdType[3];
3215:        nodeIds = new vtkIdType[6];
3221:        nodeIds = new vtkIdType[3];
3315:        nodeIds = new vtkIdType[8];
3321:        nodeIds = new vtkIdType[4];
3562:        nodeIds = new vtkIdType[10];
3568:        nodeIds = new vtkIdType[4];
3663:        nodeIds = new vtkIdType[13];
3669:        nodeIds = new vtkIdType[5];
3763:        nodeIds = new vtkIdType[20];
3769:        nodeIds = new vtkIdType[8];
3863:        nodeIds = new vtkIdType[15];
3869:        nodeIds = new vtkIdType[6];

IO/EnSight/vtkEnSight6Reader.cxx
1590:      nodeIds = new vtkIdType[1];
1632:      nodeIds = new vtkIdType[2];
1633:      intIds = new int[2];
1670:      nodeIds = new vtkIdType[2];
1671:      intIds = new int[2];
1718:      nodeIds = new vtkIdType[3];
1719:      intIds = new int[3];
1770:      nodeIds = new vtkIdType[4];
1771:      intIds = new int[4];
1823:      nodeIds = new vtkIdType[4];
1824:      intIds = new int[4];
1876:      nodeIds = new vtkIdType[5];
1877:      intIds = new int[5];
1930:      nodeIds = new vtkIdType[8];
1931:      intIds = new int[8];
1986:      nodeIds = new vtkIdType[6];
1987:      intIds = new int[6];

IO/Xdmf3/vtkXdmf3Reader.cxx
757:    allLens = new int[1];

IO/Parallel/vtkPDataSetReader.cxx
101:    this->PieceFileNames[i] = new char[512];
107:    this->PieceExtents[i] = new int[6];

IO/Parallel/vtkEnSightWriter.cxx
1069:  char* path = new char[4];
1070:  char* base = new char[20];
1123:    path = new char[4];

IO/ADIOS2/vtkADIOS2CoreImageReader.cxx
151:    allLens = new int[1];
157:  allLens = new int[1];

IO/Geometry/vtkChacoReader.cxx
70:  this->Line = new char[200];
126:      this->VarrayName[i] = new char[64];
135:      this->EarrayName[i] = new char[64];

IO/Export/vtkPOVExporter.cxx
100:    this->CountFormat = new char[100]; //"\t\t%d,\n"
105:    char* triFormat = new char[100]; //"%d, %d, %d"
112:    this->TriangleFormat1 = new char[100]; //"\t\t<%d, %d, %d>,"
117:    this->TriangleFormat2 = new char[100]; //" %d, %d, %d,\n"

Rendering/Core/vtkAbstractVolumeMapper.cxx
30:  this->ArrayName = new char[1];

Filters/Core/vtkQuadricClustering.cxx
1418:    pointTable[i] = new vtkIdType[4];

Filters/Core/vtkSmoothPolyDataFilter.cxx
75:  this->Array = new vtkSmoothPoint[1000];

Filters/Core/vtkArrayCalculator.cxx
788:    tempComponents[i] = new int[3];
819:    this->SelectedVectorComponents[i] = new int[3];
834:  this->SelectedVectorComponents[i] = new int[3];
952:    tempComponents[i] = new int[3];
983:    this->SelectedVectorComponents[i] = new int[3];
998:  this->SelectedVectorComponents[i] = new int[3];
1061:    tempComponents[i] = new int[3];
1084:    this->SelectedCoordinateVectorComponents[i] = new int[3];
1097:  this->SelectedCoordinateVectorComponents[i] = new int[3];

Interaction/Style/vtkInteractorStyleJoystickActor.cxx
269:  rotate[0] = new double[4];
270:  rotate[1] = new double[4];
352:  rotate[0] = new double[4];

Interaction/Style/vtkInteractorStyleTrackballActor.cxx
277:    rotate[0] = new double[4];
278:    rotate[1] = new double[4];
355:  rotate[0] = new double[4];

Rendering/Annotation/vtkAxisActor2D.cxx
80:  this->LabelFormat = new char[8];

Rendering/Annotation/vtkParallelCoordinatesActor.cxx
92:  this->LabelFormat = new char[8];

Rendering/Annotation/vtkAxisActor.cxx
85:  this->LabelFormat = new char[8];

Rendering/Annotation/vtkScalarBarActor.cxx
103:  this->LabelFormat = new char[8];

Rendering/Annotation/vtkLeaderActor2D.cxx
50:  this->LabelFormat = new char[8];

Rendering/Annotation/vtkXYPlotActor.cxx
76:  this->XTitle = new char[7];
110:  this->XLabelFormat = new char[8];
113:  this->YLabelFormat = new char[8];

Rendering/Annotation/vtkPolarAxesActor.cxx
361:  this->PolarAxisTitle = new char[16];
364:  this->PolarLabelFormat = new char[8];
369:  this->RadialAngleFormat = new char[8];

Rendering/Annotation/vtkCubeAxesActor2D.cxx
96:  this->LabelFormat = new char[8];
108:  this->XLabel = new char[2];
110:  this->YLabel = new char[2];
112:  this->ZLabel = new char[2];

Rendering/Annotation/vtkCubeAxesActor.cxx
233:  this->XTitle = new char[7];
236:  this->YTitle = new char[7];
239:  this->ZTitle = new char[7];
277:  this->XLabelFormat = new char[8];
279:  this->YLabelFormat = new char[8];
281:  this->ZLabelFormat = new char[8];

Rendering/Annotation/vtkBarChartActor.cxx
103:  this->YTitle = new char[1];

Rendering/Volume/vtkUnstructuredGridPartialPreIntegration.cxx
343:      this->TransferFunctions = new vtkPartialPreIntegrationTransferFunction[1];

Filters/FlowPaths/vtkAMRInterpolatedVelocityField.cxx
79:  this->Weights = new double[8];

Rendering/Volume/Testing/Cxx/TestGPURayCastClippingUserTransform.cxx
48:  double* normal = new double[3];
68:  double* origin = new double[3];

Rendering/Label/vtkLabeledTreeMapDataMapper.cxx
685:      this->FontWidths[i] = new int[95];

Filters/General/vtkHyperStreamline.cxx
116:  this->Array = new vtkHyperPoint[1000];

Filters/General/vtkUncertaintyTubeFilter.cxx
101:  this->Array = new vtkTubePoint[1000];

Filters/Hybrid/vtkTemporalSnapToTimeStep.cxx
128:    double* inTimes = new double[1];

Filters/Modeling/vtkLoopSubdivisionFilter.cxx
52:  weights = new double[256];

Filters/Modeling/vtkButterflySubdivisionFilter.cxx
52:  weights = new double[256];
53:  weights1 = new double[256];
54:  weights2 = new double[256];

Filters/ParallelMPI/vtkStructuredImplicitConnectivity.cxx
1378:    double* pnt = new double[3];

Imaging/Core/vtkImageMask.cxx
29:  this->MaskedOutputValue = new double[3];

Filters/Sources/vtkHyperTreeGridSource.cxx
89:  this->Descriptor = new char[2];
92:  this->Mask = new char[2];

Imaging/Core/vtkImageStencilData.cxx
1197:    rhead = new double[2];

Interaction/Widgets/vtkSliderRepresentation.cxx
39:  this->LabelFormat = new char[8];

Interaction/Widgets/vtkAngleRepresentation.cxx
45:  this->LabelFormat = new char[8];

Interaction/Widgets/vtkDistanceRepresentation.cxx
39:  this->LabelFormat = new char[8];

Interaction/Widgets/vtkBiDimensionalRepresentation.cxx
55:  this->LabelFormat = new char[6];

Interaction/Widgets/vtkResliceCursorRepresentation.cxx
87:  this->ThicknessLabelFormat = new char[6];

Interaction/Widgets/vtkLineRepresentation.cxx
116:  this->DistanceAnnotationFormat = new char[8];

Interaction/Widgets/Testing/Cxx/TestContourWidget2.cxx
77:  vtkIdType* lineIndices = new vtkIdType[21];

Wrapping/Java/vtk/vtkPanel.java
294:      double APoint[] = new double[3];

Wrapping/Java/vtk/sample/Demo.java
101:      double[] center = new double[3];

Web/WebGLExporter/vtkWebGLWidget.cxx
152:    double* xrgb = new double[4];

Parallel/Core/Testing/Python/SocketClient.cxx
63:  char* hostname = new char[30];

Charts/Core/vtkControlPointsItem.cxx
1730:    char* buffer = new char[1024];

Utilities/MetaIO/vtkmetaio/metaBlob.cxx
358:        float* num = new float[1];
373:        float* num = new float[1];

Utilities/MetaIO/vtkmetaio/metaDTITube.cxx
33:  m_TensorMatrix = new float[6];

Utilities/MetaIO/vtkmetaio/metaImage.cxx
1224:  char* buf = new char[8001];

Utilities/MetaIO/vtkmetaio/metaUtils.cxx
527:    compressionTable->buffer = new char[1001];

ThirdParty/diy2/vtkdiy2/include/vtkdiy2/grid.hpp
108:                    Parent(new C[0], Vertex::zero())            {}

Examples/Android/JavaVTK/src/com/kitware/JavaVTK/JavaVTKView.java
158:            int[] num_config = new int[1];
223:        private int[] mValue = new int[1];

ThirdParty/vtkm/vtkvtkm/vtk-m/docs/changelog/1.3/release-notes.md
320:  T* buffer = new T[100];

ThirdParty/vtkm/vtkvtkm/vtk-m/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/grid.hpp
107:                    Parent(new C[0], Vertex::zero())            {}

ThirdParty/vtkm/vtkvtkm/vtk-m/examples/contour_tree_distributed/ContourTreeApp.cxx
271:  char* cstr_filename = new char[15];

ThirdParty/vtkm/vtk-m/vtkm/thirdparty/diy/vtkmdiy/include/vtkmdiy/grid.hpp
101:                    Parent(new C[0], Vertex::zero())            {}

ThirdParty/vtkm/vtk-m/docs/changelog/array-handle-memory-ownership.md
10:  T* buffer = new T[100];

ThirdParty/sqlite/vtksqlite/sqlite3.c
94271:** sets the PmaReader fields to read from the new aFile[0] and kicks off
94272:** another background thread to populate the new aFile[1]. And so on, until
95833:** to populate the new aFile[1].
Edited Feb 05, 2021 by Mathieu Westphal
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: vtk/vtk#18116