X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f Message-ID: <405CD11B.E5491C50@yahoo.com> From: CBFalconer Organization: Ched Research X-Mailer: Mozilla 4.75 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: How can I monitor the amount of free RAM? References: <200403191751 DOT i2JHp99L022683 AT envy DOT delorie DOT com> <16f148d8 DOT 0403200738 DOT 6034bc04 AT posting DOT google DOT com> <6hfp505rsl51sl3qpmj4bqtr34bfs2jg20 AT 4ax DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 38 Date: Sat, 20 Mar 2004 23:24:02 GMT NNTP-Posting-Host: 12.76.137.179 X-Complaints-To: abuse AT worldnet DOT att DOT net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1079825042 12.76.137.179 (Sat, 20 Mar 2004 23:24:02 GMT) NNTP-Posting-Date: Sat, 20 Mar 2004 23:24:02 GMT To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Brian Inglis wrote: > kantsel AT mail DOT ru (Anthony) wrote: > >DJ Delorie wrote in message news: > >>> > 1. What memory should I monitor (DOS (below 1MB), upper,...) >>> >>> Virtual. >>> >>> > 2. How can do that? >>> >>> You don't want to monitor free memory, you want to monitor *used* >>> memory (other things on the computer might use memory too). Most >>> programs can use the sbrk(0) call to ask libc where the top of your >>> memory is. If it doesn't change, you're not asking for more memory. >>> >>> The exception is if you choose the "non-moving sbrk" option (nearptr, >>> DMA, etc need this) in which case your memory range is discontiguous >>> and sbrk() moves all over the place during allocation. But at least >>> you can tell if it changes *at all*. >> >> Thanks, I'll use it. But sill, if I want to know how much memory do I >> have left, how can I? > > There's a bunch of new functions giving malloc information, esp. > mallinfo, malloc_debug, mallocmap, in the DJGPP 2.04 beta release, if > you want to go to the effort of installing and trying a beta release. Those are all available in 2.03 with the nmalloc package I mentioned earlier. Just follow the instructions to link the malloc and malldbg objects before the library search. What is NOT available in that package is a memalign routine that works for arbitrary alignment. -- Chuck F (cbfalconer AT yahoo DOT com) (cbfalconer AT worldnet DOT att DOT net) Available for consulting/temporary embedded and systems. USE worldnet address!