🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4661

Re: Program is very large in memory. How to decrease ?

#4661
From: Ed Mulroy
Date: Fri, 16 Dec 2005 16:28
24 lines
2010 bytes
When Windows loads a program it assigns a stack size for that program.  The 
full size of that stack is not actually allocated but it is included in the 
reported memory use.  Only a small stack is allocated along with a protected 
'guard page' following it.  When the program uses enough stack that it 
access the guard page, Windows uses that access as a trigger to add another 
chunk of memory to the stack and allocate a guard page following that.

In other words, most of that reported memory usage is virtual memory, memory 
that is not physically allocated.

The linker options allow you to specify a stack size.

.  Ed

> MMX wrote in message
> news:43a27bfd@newsgroups.borland.com...
> Hi.
> I've wrote the service program using only WinAPI.  Compiled .exe file is 
> ~60
> kb on disk. But when it executing it tooks ~950 kb in memory even if do
> nothing just:
> while (true) Sleep(50);
>
> Why is it so big in memory and how to decrease it size.
Technical Details
Message-ID: <43a2eafa@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43a27bfd@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,6af733692ddeff34
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Ed Mulroy" <dont_email_me@bitbuc.ket>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <43a27bfd@newsgroups.borland.com>
Subject: Re: Program is very large in memory. How to decrease ?
Date: Fri, 16 Dec 2005 11:28:55 -0500
Lines: 26
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
X-RFC2646: Format=Flowed; Original
NNTP-Posting-Host: 69.134.170.196
Message-ID: <43a2eafa@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1134750458 69.134.170.196 (16 Dec 2005 08:27:38 -0700)
X-Authenticated-User: edmulroy
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!feed5.newsreader.com!newsreader.com!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail