delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/09/26/09:00:18

From: "Edmund Horner" <ejrh AT paradise DOT net DOT nz>
Newsgroups: comp.os.msdos.djgpp
References: <8qns3d$6g4$1 AT diana DOT bcn DOT ttd DOT net> <7263-Tue26Sep2000085518+0300-eliz AT is DOT elta DOT co DOT il> <8qprpe$l72$1 AT diana DOT bcn DOT ttd DOT net>
Subject: Re: negative sbrk(0)
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Organization: Paradise Net
Message-ID: <969973140.340672@shelley.paradise.net.nz>
Cache-Post-Path: shelley.paradise.net.nz!unknown AT 203-96-154-168 DOT tnt7 DOT paradise DOT net DOT nz
X-Cache: nntpcache 2.4.0b5 (see http://www.nntpcache.org/)
Date: Wed, 27 Sep 2000 01:01:50 +1200
NNTP-Posting-Host: 203.96.152.26
X-Complaints-To: newsadmin AT xtra DOT co DOT nz
X-Trace: news.xtra.co.nz 969973141 203.96.152.26 (Wed, 27 Sep 2000 00:59:01 NZST)
NNTP-Posting-Date: Wed, 27 Sep 2000 00:59:01 NZST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I understand that even if you allocate a block bigger than you have free
memory, the DPMI service won't actually start the virtual memory up until
you actually _use_ it.

"Rafael García" <rafael AT geninfor DOT com> wrote in message
news:8qprpe$l72$1 AT diana DOT bcn DOT ttd DOT net...
> > > Well, I have got sbrk(0) to return negative values in some cases, so
the
> > > function tells I have -1950Kb.
> >
> > sbrk returns an insigned value, not a signed one.  So negative values
> > are actually very large positive ones.  Happens a lot on Windows.
>
> So... I cannot use that function I read somewhere to know available
memory?
>
> Is there another method?
>
> Suppose I want to write a program that uses a variable size file in
various
> size computers. I would like to have it in ram if possible, or access it
> from disk if I have not enough ram. But if file size is for example 10 Mb
> and available ram is 10.5 Mb I don't want to load it.
>
> Perhaps I must try malloc(1.5*filelength(f)) to decide if it is good idea
to
> load entire file in ram, but I thougth it would be better technique to
watch
> available before. I think it is possible a long delay for virtual
allocation
> if I ask for 20 Mb in a 2Mb ram machine, and in this environment I would
> prefer to let data on disk and read it myself as necessary, saving real
ram
> for other more important purposes.
>
>
> Thanks
> Rafael García
>
>
>


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019