Commit 04c85e54 authored by Ken Martin's avatar Ken Martin

fix memory leak

parent 886bed71
......@@ -16,10 +16,11 @@
#include "vtkCell.h"
#include "vtkDataSet.h"
#include "vtkGarbageCollector.h"
#include "vtkObjectFactory.h"
#include "vtkPointData.h"
vtkCxxRevisionMacro(vtkImplicitDataSet, "1.23");
vtkCxxRevisionMacro(vtkImplicitDataSet, "1.24");
vtkStandardNewMacro(vtkImplicitDataSet);
vtkCxxSetObjectMacro(vtkImplicitDataSet,DataSet,vtkDataSet);
......@@ -183,3 +184,27 @@ void vtkImplicitDataSet::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Data Set: (none)\n";
}
}
//----------------------------------------------------------------------------
void vtkImplicitDataSet::ReportReferences(vtkGarbageCollector* collector)
{
this->Superclass::ReportReferences(collector);
#ifdef VTK_USE_EXECUTIVES
// These filters share our input and are therefore involved in a
// reference loop.
collector->ReportReference(this->DataSet, "DataSet");
#endif
}
//----------------------------------------------------------------------------
void vtkImplicitDataSet::RemoveReferences()
{
#ifdef VTK_USE_EXECUTIVES
if(this->DataSet)
{
this->DataSet->Delete();
this->DataSet = 0;
}
#endif
this->Superclass::RemoveReferences();
}
......@@ -86,6 +86,9 @@ protected:
vtkImplicitDataSet();
~vtkImplicitDataSet();
virtual void ReportReferences(vtkGarbageCollector*);
virtual void RemoveReferences();
vtkDataSet *DataSet;
double OutValue;
double OutGradient[3];
......
......@@ -13,9 +13,11 @@
=========================================================================*/
#include "vtkImplicitWindowFunction.h"
#include "vtkGarbageCollector.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkImplicitWindowFunction, "1.17");
vtkCxxRevisionMacro(vtkImplicitWindowFunction, "1.18");
vtkStandardNewMacro(vtkImplicitWindowFunction);
vtkCxxSetObjectMacro(vtkImplicitWindowFunction,ImplicitFunction,vtkImplicitFunction);
......@@ -130,3 +132,28 @@ void vtkImplicitWindowFunction::PrintSelf(ostream& os, vtkIndent indent)
<< ", " << this->WindowValues[1] << ")\n";
}
//----------------------------------------------------------------------------
void vtkImplicitWindowFunction::ReportReferences(
vtkGarbageCollector* collector)
{
this->Superclass::ReportReferences(collector);
#ifdef VTK_USE_EXECUTIVES
// These filters share our input and are therefore involved in a
// reference loop.
collector->ReportReference(this->ImplicitFunction, "ImplicitFunction");
#endif
}
//----------------------------------------------------------------------------
void vtkImplicitWindowFunction::RemoveReferences()
{
#ifdef VTK_USE_EXECUTIVES
if(this->ImplicitFunction)
{
this->ImplicitFunction->Delete();
this->ImplicitFunction = 0;
}
#endif
this->Superclass::RemoveReferences();
}
......@@ -78,6 +78,9 @@ protected:
vtkImplicitWindowFunction();
~vtkImplicitWindowFunction();
virtual void ReportReferences(vtkGarbageCollector*);
virtual void RemoveReferences();
vtkImplicitFunction *ImplicitFunction;
double WindowRange[2];
double WindowValues[2];
......
......@@ -15,9 +15,10 @@
#include "vtkScalarTree.h"
#include "vtkDataSet.h"
#include "vtkGarbageCollector.h"
#include "vtkObjectFactory.h"
vtkCxxRevisionMacro(vtkScalarTree, "1.29");
vtkCxxRevisionMacro(vtkScalarTree, "1.30");
vtkCxxSetObjectMacro(vtkScalarTree,DataSet,vtkDataSet);
// Instantiate scalar tree with maximum level of 20 and branching
......@@ -49,3 +50,24 @@ void vtkScalarTree::PrintSelf(ostream& os, vtkIndent indent)
os << indent << "Build Time: " << this->BuildTime.GetMTime() << "\n";
}
//----------------------------------------------------------------------------
void vtkScalarTree::ReportReferences(vtkGarbageCollector* collector)
{
this->Superclass::ReportReferences(collector);
#ifdef VTK_USE_EXECUTIVES
collector->ReportReference(this->DataSet, "DataSet");
#endif
}
//----------------------------------------------------------------------------
void vtkScalarTree::RemoveReferences()
{
#ifdef VTK_USE_EXECUTIVES
if(this->DataSet)
{
this->DataSet->Delete();
this->DataSet = 0;
}
#endif
this->Superclass::RemoveReferences();
}
......@@ -83,6 +83,9 @@ protected:
vtkTimeStamp BuildTime; //time at which tree was built
double ScalarValue; //current scalar value for traversal
virtual void ReportReferences(vtkGarbageCollector*);
virtual void RemoveReferences();
private:
vtkScalarTree(const vtkScalarTree&); // Not implemented.
void operator=(const vtkScalarTree&); // Not implemented.
......
......@@ -19,7 +19,7 @@
#include "vtkPointData.h"
#include "vtkCachedStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkImageCacheFilter, "1.22");
vtkCxxRevisionMacro(vtkImageCacheFilter, "1.23");
vtkStandardNewMacro(vtkImageCacheFilter);
//----------------------------------------------------------------------------
......@@ -29,15 +29,19 @@ vtkImageCacheFilter::vtkImageCacheFilter()
this->Data = NULL;
this->Times = NULL;
vtkExecutive *exec = this->CreateDefaultExecutive();
this->SetExecutive(exec);
exec->Delete();
this->SetCacheSize(10);
this->SetExecutive(this->CreateDefaultExecutive());
this->vtkSource::SetNthOutput(0,vtkImageData::New());
}
//----------------------------------------------------------------------------
vtkImageCacheFilter::~vtkImageCacheFilter()
{
#ifndef VTK_USE_EXECUTIVES
this->SetCacheSize(0);
#endif
}
//----------------------------------------------------------------------------
......@@ -128,7 +132,7 @@ void vtkImageCacheFilter::SetCacheSize(int size)
#ifdef VTK_USE_EXECUTIVES
//----------------------------------------------------------------------------
// This method simply copies by reference the input data to the output.
void vtkImageCacheFilter::ExecuteData(vtkDataObject *outObject)
void vtkImageCacheFilter::ExecuteData(vtkDataObject *)
{
}
#else
......
......@@ -24,7 +24,7 @@
#include "vtkPipelineSize.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkCxxRevisionMacro(vtkMemoryLimitImageDataStreamer, "1.9");
vtkCxxRevisionMacro(vtkMemoryLimitImageDataStreamer, "1.10");
vtkStandardNewMacro(vtkMemoryLimitImageDataStreamer);
//----------------------------------------------------------------------------
......@@ -200,6 +200,7 @@ int vtkMemoryLimitImageDataStreamer::ProcessUpstreamRequest(
// undo the last *2
this->NumberOfStreamDivisions = this->NumberOfStreamDivisions/2;
sizer->Delete();
}
return
this->Superclass::ProcessUpstreamRequest(request,
......
......@@ -14,14 +14,15 @@
=========================================================================*/
#include "vtkEncodedGradientEstimator.h"
#include "vtkGarbageCollector.h"
#include "vtkImageData.h"
#include "vtkMultiThreader.h"
#include "vtkRecursiveSphereDirectionEncoder.h"
#include "vtkTimerLog.h"
#include "vtkImageData.h"
#include <math.h>
vtkCxxRevisionMacro(vtkEncodedGradientEstimator, "1.34");
vtkCxxRevisionMacro(vtkEncodedGradientEstimator, "1.35");
vtkCxxSetObjectMacro(vtkEncodedGradientEstimator, Input, vtkImageData );
......@@ -368,3 +369,26 @@ void vtkEncodedGradientEstimator::PrintSelf(ostream& os, vtkIndent indent)
// << this->InputAspect << endl;
}
//----------------------------------------------------------------------------
void vtkEncodedGradientEstimator::ReportReferences(
vtkGarbageCollector* collector)
{
this->Superclass::ReportReferences(collector);
#ifdef VTK_USE_EXECUTIVES
collector->ReportReference(this->Input, "Input");
#endif
}
//----------------------------------------------------------------------------
void vtkEncodedGradientEstimator::RemoveReferences()
{
#ifdef VTK_USE_EXECUTIVES
if(this->Input)
{
this->Input->Delete();
this->Input = 0;
}
#endif
this->Superclass::RemoveReferences();
}
......@@ -169,6 +169,9 @@ protected:
vtkEncodedGradientEstimator();
~vtkEncodedGradientEstimator();
virtual void ReportReferences(vtkGarbageCollector*);
virtual void RemoveReferences();
// The number of threads to use when encoding normals
int NumberOfThreads;
......
......@@ -14,11 +14,12 @@
=========================================================================*/
#include "vtkVolumeMapper.h"
#include "vtkGarbageCollector.h"
#include "vtkImageClip.h"
#include "vtkImageData.h"
#include "vtkDataSet.h"
vtkCxxRevisionMacro(vtkVolumeMapper, "1.52");
vtkCxxRevisionMacro(vtkVolumeMapper, "1.53");
// Construct a vtkVolumeMapper with empty scalar input and clipping off.
vtkVolumeMapper::vtkVolumeMapper()
......@@ -42,7 +43,11 @@ vtkVolumeMapper::vtkVolumeMapper()
vtkVolumeMapper::~vtkVolumeMapper()
{
this->ImageClipper->Delete();
if (this->ImageClipper)
{
this->ImageClipper->Delete();
this->ImageClipper = 0;
}
}
void vtkVolumeMapper::ConvertCroppingRegionPlanesToVoxels()
......@@ -157,3 +162,29 @@ void vtkVolumeMapper::PrintSelf(ostream& os, vtkIndent indent)
<< (this->UseImageClipper ? "On\n" : "Off\n");
}
//----------------------------------------------------------------------------
void vtkVolumeMapper::ReportReferences(vtkGarbageCollector* collector)
{
this->Superclass::ReportReferences(collector);
#ifdef VTK_USE_EXECUTIVES
// These filters share our input and are therefore involved in a
// reference loop.
if (this->UseImageClipper)
{
collector->ReportReference(this->ImageClipper, "ImageClipper");
}
#endif
}
//----------------------------------------------------------------------------
void vtkVolumeMapper::RemoveReferences()
{
#ifdef VTK_USE_EXECUTIVES
if(this->ImageClipper)
{
this->ImageClipper->Delete();
this->ImageClipper = 0;
}
#endif
this->Superclass::RemoveReferences();
}
......@@ -122,6 +122,9 @@ protected:
vtkVolumeMapper();
~vtkVolumeMapper();
virtual void ReportReferences(vtkGarbageCollector*);
virtual void RemoveReferences();
// Cropping variables, and a method for converting the world
// coordinate cropping region planes to voxel coordinates
int Cropping;
......
......@@ -18,6 +18,7 @@
#include "vtkEncodedGradientEstimator.h"
#include "vtkEncodedGradientShader.h"
#include "vtkFiniteDifferenceGradientEstimator.h"
#include "vtkGarbageCollector.h"
#include "vtkGraphicsFactory.h"
#include "vtkImageData.h"
#include "vtkMath.h"
......@@ -34,7 +35,7 @@
#include <math.h>
vtkCxxRevisionMacro(vtkVolumeRayCastMapper, "1.104");
vtkCxxRevisionMacro(vtkVolumeRayCastMapper, "1.105");
//----------------------------------------------------------------------------
// Needed when we don't use the vtkStandardNewMacro.
......@@ -1994,3 +1995,26 @@ void vtkVolumeRayCastMapper::PrintSelf(ostream& os, vtkIndent indent)
}
//----------------------------------------------------------------------------
void vtkVolumeRayCastMapper::ReportReferences(vtkGarbageCollector* collector)
{
this->Superclass::ReportReferences(collector);
#ifdef VTK_USE_EXECUTIVES
// These filters share our input and are therefore involved in a
// reference loop.
collector->ReportReference(this->GradientEstimator, "GradientEstimator");
#endif
}
//----------------------------------------------------------------------------
void vtkVolumeRayCastMapper::RemoveReferences()
{
#ifdef VTK_USE_EXECUTIVES
if(this->GradientEstimator)
{
this->GradientEstimator->Delete();
this->GradientEstimator = 0;
}
#endif
this->Superclass::RemoveReferences();
}
......@@ -189,6 +189,9 @@ protected:
vtkEncodedGradientEstimator *GradientEstimator;
vtkEncodedGradientShader *GradientShader;
virtual void ReportReferences(vtkGarbageCollector*);
virtual void RemoveReferences();
// The distance between sample points along the ray
double SampleDistance;
double ImageSampleDistance;
......
......@@ -16,12 +16,13 @@
#include "vtkEncodedGradientShader.h"
#include "vtkFiniteDifferenceGradientEstimator.h"
#include "vtkGarbageCollector.h"
#include "vtkImageData.h"
#include "vtkRenderer.h"
#include "vtkVolume.h"
#include "vtkVolumeProperty.h"
vtkCxxRevisionMacro(vtkVolumeTextureMapper, "1.28");
vtkCxxRevisionMacro(vtkVolumeTextureMapper, "1.29");
vtkVolumeTextureMapper::vtkVolumeTextureMapper()
{
......@@ -262,3 +263,27 @@ void vtkVolumeTextureMapper::PrintSelf(ostream& os, vtkIndent indent)
// this->DataSpacing is a temporary variable that should not be printed
// this->DataOrigin is a temporary variable that should not be printed
}
//----------------------------------------------------------------------------
void vtkVolumeTextureMapper::ReportReferences(vtkGarbageCollector* collector)
{
this->Superclass::ReportReferences(collector);
#ifdef VTK_USE_EXECUTIVES
// These filters share our input and are therefore involved in a
// reference loop.
collector->ReportReference(this->GradientEstimator, "GradientEstimator");
#endif
}
//----------------------------------------------------------------------------
void vtkVolumeTextureMapper::RemoveReferences()
{
#ifdef VTK_USE_EXECUTIVES
if(this->GradientEstimator)
{
this->GradientEstimator->Delete();
this->GradientEstimator = 0;
}
#endif
this->Superclass::RemoveReferences();
}
......@@ -96,6 +96,9 @@ protected:
void InitializeRender( vtkRenderer *ren, vtkVolume *vol );
virtual void ReportReferences(vtkGarbageCollector*);
virtual void RemoveReferences();
// Objects / variables needed for shading / gradient magnitude opacity
vtkEncodedGradientEstimator *GradientEstimator;
vtkEncodedGradientShader *GradientShader;
......
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