 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Mon Aug 28, 2006 8:10 am Post subject: How to make sure the memory has be released |
|
|
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;
//------------------------------------------------------------------------------------------------------------------------- |
|
| Back to top |
|
 |
4N Guest
|
Posted: Mon Aug 28, 2006 4:45 pm Post subject: 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...
<YHWu912 (AT) gmail (DOT) com> ha scritto nel messaggio
news:1156744784.360109.297070 (AT) 74g2000cwt (DOT) googlegroups.com...
| 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;
//-------------------------------------------------------------------------------------------------------------------------
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|