Article View: borland.public.cppbuilder.nativeapi
Article #9363Thread and memory
From: Sara T.
Date: Mon, 19 Jul 2004 03:18
Date: Mon, 19 Jul 2004 03:18
33 lines
1584 bytes
1584 bytes
I write a code of thread and often found the process eat mem too much, I
suspect the method to create threads in main program.
If I call main program a lot of times, can it make some memory leak? Because
I cannot delete and don't know where to delete object MyThread.
I see my application run two or three days, it takes over 400MB of physicall
memory and 500MB of virtual memory.
Please help.
Main:
CMyThread *MyThread = new MyThread();
MyThread->Resume();
__fastcall CMyThread::CMyThread(bool CreateSuspended)
: TThread(CreateSuspended)
{
FreeOnTerminate = true;
}
void __fastcall CMyThread::Execute(void)
{
if (Terminated) return;
// Process here
//
FreeOnTerminate = true;
Terminate();
}
Sara T.
Technical Details
Message-ID:
<40fb3d08@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,d35c53850c011fac,start X-Google-Attributes: gid10cc67,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Sara T." <sarana@infoquest.co.th> Newsgroups: borland.public.cppbuilder.nativeapi Subject: Thread and memory Date: Mon, 19 Jul 2004 10:18:31 +0700 Lines: 35 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 NNTP-Posting-Host: 169.210.34.33 Message-ID: <40fb3d08@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1090206984 169.210.34.33 (18 Jul 2004 20:16:24 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail