| delorie.com/archives/browse.cgi | search |
| From: | "Rafael García" <rafael AT geninfor DOT com> |
| Newsgroups: | comp.os.msdos.djgpp |
| Subject: | negative sbrk(0) |
| Date: | Mon, 25 Sep 2000 17:50:04 +0200 |
| Organization: | Telefonica Transmision de Datos |
| Lines: | 29 |
| Message-ID: | <8qns3d$6g4$1@diana.bcn.ttd.net> |
| NNTP-Posting-Host: | 193.153.205.157 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Newsreader: | Microsoft Outlook Express 5.00.2014.211 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2014.211 |
| To: | djgpp AT delorie DOT com |
| DJ-Gateway: | from newsgroup comp.os.msdos.djgpp |
| Reply-To: | djgpp AT delorie DOT com |
Hello all. Today a question about sbrk(). I have this function to know free
memory:
long availmem(void) {
static long initially=0;
long limit;
static long initial_limit;
long burnt;
if (!initially) {
initially=_go32_dpmi_remaining_physical_memory();
assert(initially>0);
}
if (!initial_limit)
initial_limit=(long)sbrk(0);
limit=(long)sbrk(0);
burnt=limit-initial_limit;
return initially-burnt;
}
Well, I have got sbrk(0) to return negative values in some cases, so the
function tells I have -1950Kb.
Anybody has a solution?
Thanks
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |