[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
thread memory leak
From: |
taraben . a |
Subject: |
thread memory leak |
Date: |
Mon, 03 Feb 2003 01:03:39 +0100 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.2.1) Gecko/20021130 |
Hello,
I get 3 Memory leaks when I run this example(BorlandC/Win32/latest CVS
version)
leaks:
2x myThread each 32 byte
1x MainThread 32 byte
Can someone pls help me and point what is wrong?
Thanks,
Adib.
//---------------------------------------------------------------------------
class myThread : public Thread
{
char m_c;
public:
myThread(char c){m_c=c;}
void run(void)
{
setCancel(Thread::cancelImmediate);
while(1)
{
std::cout << m_c;
sleep(500);
}
}
};
#pragma argsused
int main(int argc, char* argv[])
{
myThread *a=new myThread('a'), *b=new myThread('b');
a->detach();
b->start();
char z=0;
while(1)
{
z=getch();
if(z=='a') a->suspend();
else if(z=='b') b->suspend();
else if(z=='A') a->resume();
else if(z=='B') b->resume();
printf("zei=%c", z);
if(z==0x1b) break;
}
delete a;
delete b;
}
- thread memory leak,
taraben . a <=