Article View: borland.public.cppbuilder.nativeapi
Article #10280Re: Thread creation error: not enough memory
From: Lothar
Date: Wed, 21 Apr 2004 15:54
Date: Wed, 21 Apr 2004 15:54
45 lines
2534 bytes
2534 bytes
Hi Eugene,
that would be an easy solution, but : FreeOnTerminate = True;
try {
HotlineThread[Line] = new THotlineThread(Line);
HotlineThread[Line]->SuspendResume = SuspendTrue;
HotlineThread[Line]->FreeOnTerminate = True;
HotlineThread[Line]->Priority = tpNormal;
HotlineThread[Line]->Resume();
} catch(const Exception& e) {
in the thread:
__fastcall THotlineThread::THotlineThread(int Nr): TThread(true)
//__fastcall THotlineThread::THotlineThread(bool CreateSuspended)
// : TThread(CreateSuspended)
{
LineNr = Nr;
FreeOnTerminate = True;
}
I checked every new with the coresponding delete or for the threads
there is FreeOnTerminate = True;
I think, that I need to understand more about memory. After this error
there was still:
dwTotalVirtual = 2097024 KB
dwAvailVirtual = 1825704 KB
plenty. So which limited memory does that use?
Eugene Mayevski [SecureBlackbox] schrieb:
> Lothar wrote:
>
>> every 7-10 days my program comes up with an exception:
>> Thread creation error: Nicht gen๏ฟฝgend Arbeitsspeicher (not enough
>> memory)
>
>
> Each thread is allocated with 1MB of virtual memory for stack.
> Although it's virtual memory, it's also limited with 2Gb. Looks like
> this is the memory that's missing - you don't free threads and create
> other ones. Soon your application gets more than 2K of threads running
> (sleeping) and you get into this trouble.
>
Technical Details
Message-ID:
<408698f3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<4086696d$1@newsgroups.borland.com> <40867831@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII X-Google-Thread: 10cc67,c8565ce6e82c46dd X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2004-04-21 09:10:38 PST Date: Wed, 21 Apr 2004 17:54:22 +0200 From: Lothar <Lothar.Huppertz@gmx.de> User-Agent: Mozilla/5.0 (Windows; U; WinNT4.0; de-DE; rv:1.4) Gecko/20030619 Netscape/7.1 (ax) X-Accept-Language: de-DE, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Thread creation error: not enough memory References: <4086696d$1@newsgroups.borland.com> <40867831@newsgroups.borland.com> In-Reply-To: <40867831@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit NNTP-Posting-Host: 80.133.141.45 Message-ID: <408698f3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1082562803 80.133.141.45 (21 Apr 2004 08:53:23 -0700) Lines: 46 Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail