A
Andrew King
Hi everyone,
I've got a problem with segmentation faults occurring in the
destructor of an object that I have. The only thing that I'm deleting
is an array. The destructor is
Experiment::~Experiment(){
if(ClusteringS) delete [] ClusteringS;
ClusteringS = NULL;
}
and the array is allocated in
void Experiment::ClusteringSAlloc(Graph& graph)
{
ClusteringS = new int [graph.Order];
}
Other than that, there's nothing unusual going on with the array. All
the calls have the flavour of
ClusteringS = graph.WhichCluster;
The seg fault doesn't always happen, either. Seems to be about half
the time. Any ideas? I'm kind of new to trying to use destructors
properly, so it could be something kind of easy, but I suspect not.
I've got a problem with segmentation faults occurring in the
destructor of an object that I have. The only thing that I'm deleting
is an array. The destructor is
Experiment::~Experiment(){
if(ClusteringS) delete [] ClusteringS;
ClusteringS = NULL;
}
and the array is allocated in
void Experiment::ClusteringSAlloc(Graph& graph)
{
ClusteringS = new int [graph.Order];
}
Other than that, there's nothing unusual going on with the array. All
the calls have the flavour of
ClusteringS = graph.WhichCluster;
The seg fault doesn't always happen, either. Seems to be about half
the time. Any ideas? I'm kind of new to trying to use destructors
properly, so it could be something kind of easy, but I suspect not.