Commit 67941d51 authored by Robert Maynard's avatar Robert Maynard
Browse files

Resolve memory leak #11982.

Needed a custom copy constructor so that the connectivity cache in
the ExodusIIReader doesn't reset when the cached is valid.
parent d94d7c2a
......@@ -213,19 +213,29 @@ extern "C" { typedef int (*vtkExodusIIGetMapFunc)( int, int* ); }
#include "vtkExodusIIReaderVariableCheck.h"
// --------------------------------------------------- PRIVATE CLASS Implementations
const vtkExodusIIReaderPrivate::BlockSetInfoType &block):
//this is needed to properly manage memory.
//when vectors are resized or reserved the container
//might be copied to a memory spot, so we need a proper copy constructor
//so that the cache remains valid
this->CachedConnectivity = block.CachedConnectivity;
//this is needed to properly manage memory.
//when vectors are resized or reserved they have the chance of copying
//the objects and destroying the old objects, which will leave the CachedConnectivity hanging
//this fixes is in respone to Bug #11982
if ( this->CachedConnectivity )
if (this->CachedConnectivity)
// ----------------------------------------------------------- UTILITY ROUTINES
// This function exists because FORTRAN ordering sucks.
......@@ -357,7 +357,8 @@ public:
/// Cached cell connectivity arrays for mesh
vtkUnstructuredGrid* CachedConnectivity;
BlockSetInfoType() { this->CachedConnectivity = 0; }
BlockSetInfoType(const BlockSetInfoType& block);
......@@ -375,7 +376,7 @@ public:
int CellType;
// Number of points per cell as used by VTK
// -- not what's in the file (i.e., BdsPerEntry[0] >= PointsPerCell)
int PointsPerCell;
int PointsPerCell;
/// A struct to hold information about Exodus blocks
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment