BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to make sure the memory has be released

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (WinAPI)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Mon Aug 28, 2006 8:10 am    Post subject: How to make sure the memory has be released Reply with 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
4N
Guest





PostPosted: Mon Aug 28, 2006 4:45 pm    Post subject: Re: How to make sure the memory has be released Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (WinAPI) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.