for(int k=0; k<RB_ANALOGTOOL_MAXNUMCHANNELS; k++)
{ m_QueuesDig[k] = new cSampleQueue(0,-1);
}
for (int k=0; k<RB_ANALOGTOOL_MAXNUMCHANNELS; k++)
{
m_QueuesDig[k]->Clear();//line 3
}*
I want to know whether line 3 will deallocate the memory or just clear the data in each location.
If it does not deallocate the memory let me know how it can be done.
I am trying delete[] m_QueuesDig but getting violation.“This may be due to a corruption of the heap,which indicates a bug in adtf_devenv.exe or any of the DLLs it has loaded”.
Can any one let me know some solution regarding above problem.
You don't have line numbers, so I don't which line you have in mind.
There's nothing in your code that implies deallocation.
As you're using C++ (and not C), why not use a standard collection?
1 2 3 4 5 6 7 8
typedef std::vector<CSampleQueue*> QueueType;
QueueType m_QueuesDlg;
for (int k = 0; k < RB_ANALOGTOOL_MAXNUMCHANNELS; ++k)
m_QueuesDig.push_back(new cSampleQueue(0,-1));
for (auto p in m_QueuesDig)
p->Clear();