M
madhu
vector<vector<vector<long> > > Vector3D; // 3dvector.
for (long k = 0; j < Depth; j++ )
{
Vector3D.push_back ( vector<vector<A_Type> >() );
for (long j = 0; j < Height; j++ )
{
Vector3D[k].push_back ( vector<A_Type>() );
for ( long i = 0; i < Width; i++ )
{
Vector3D[k][j].push_back ( i );
}
}
}
Vector3D.clear();
//memory deallocation
The program is crashed at run time.
?I have few questions.
What may be the reason behind crash?
Is Vector3D.clear() is sufficient to deallocate memory in all
dimention?
Is there any better way to deallocate the memory?
Do we need to deallocate memory in a vector?
for (long k = 0; j < Depth; j++ )
{
Vector3D.push_back ( vector<vector<A_Type> >() );
for (long j = 0; j < Height; j++ )
{
Vector3D[k].push_back ( vector<A_Type>() );
for ( long i = 0; i < Width; i++ )
{
Vector3D[k][j].push_back ( i );
}
}
}
Vector3D.clear();
//memory deallocation
The program is crashed at run time.
?I have few questions.
What may be the reason behind crash?
Is Vector3D.clear() is sufficient to deallocate memory in all
dimention?
Is there any better way to deallocate the memory?
Do we need to deallocate memory in a vector?