Board index » cppbuilder » How to make sure the memory has be released

How to make sure the memory has be released


2006-08-28 01:59:44 PM
cppbuilder82
Dear Someone
I have a problem about new/delete ,this code is a recorder
project,it will stop when the slient event haapened and then write a
wave file,and continue record.
In my code ,I have new 2 class and new a array , when stop function
called ,they should be destory
but memory isn't be released,why??Could someone help me to solve
it??thanks...
//New------------------------------------------------------------------------------------------------------------------
m_WaveFile = new CWaveFile(Nombre,FrecMuestreo,Resolucion,m_TamBuffer);
Audio = new CAudioCap(Edit1->Text.c_str(),m_Frecuencia,m_Sample);
m_Buffer = new byte[m_TamBuffer];
//Delete---------------------------------------------------------------------------------------------------------------
delete [](m_Buffer);
delete (Form1->Audio);
delete m_WaveFile;
//-------------------------------------------------------------------------------------------------------------------------
 
 

Re:How to make sure the memory has be released

delete []m_Buffer;
works just fine, and the rest looks ok to me.
Maybe you forgot to delete some other buffer or you corrupted the heap
somewhere so the behaviour of your app is funny...
< XXXX@XXXXX.COM >ha scritto nel messaggio
Quote
Dear Someone
I have a problem about new/delete ,this code is a recorder
project,it will stop when the slient event haapened and then write a
wave file,and continue record.
In my code ,I have new 2 class and new a array , when stop function
called ,they should be destory
but memory isn't be released,why??Could someone help me to solve
it??thanks...


//New------------------------------------------------------------------------------------------------------------------
m_WaveFile = new CWaveFile(Nombre,FrecMuestreo,Resolucion,m_TamBuffer);
Audio = new CAudioCap(Edit1->Text.c_str(),m_Frecuencia,m_Sample);
m_Buffer = new byte[m_TamBuffer];

//Delete---------------------------------------------------------------------------------------------------------------
delete [](m_Buffer);
delete (Form1->Audio);
delete m_WaveFile;
//-------------------------------------------------------------------------------------------------------------------------