www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/06/08/13:45:59

From: Kevin Ashley <k DOT ashley AT ulcc DOT ac DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: I don't want swapping
Date: Mon, 08 Jun 1998 18:36:09 +0100
Organization: Posted via ULCC Internet Services
Lines: 28
Message-ID: <357C2109.167E@ulcc.ac.uk>
References: <3 DOT 0 DOT 3 DOT 32 DOT 19980602183929 DOT 006ad4e4 AT ns DOT coba DOT net> <3 DOT 0 DOT 3 DOT 32 DOT 19980603141855 DOT 0068cd44 AT ns DOT coba DOT net>
NNTP-Posting-Host: silver.ulcc.ac.uk
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Daniel Delorme wrote:
[snip]
> 
> Have you tried this with Win95 ? I've run my program (included below)
> on 64MB of RAM and it seems that the DOS box can always allocate 64MB
> of locked memory. I ran the program in 2 dos boxes simultaneously and
> I could allocate 64MB of LOCKED memory in EACH before getting NULL
> from malloc().

You misunderstand what's happening. malloc does not get physical memory;
it gets virtual memory. malloc()'s successful return tells you that 
your program still has enough room in its address space to deal with
what
you asked for. The pages don't exist until something references
them. This is normal behaviour in a virtual-memory system. Try using
calloc (which zeros memory before giving it to you) instead of malloc
and you'll see a change in behaviour. The reason your examples give up
at 64MByte is because Windows won't give your DOS DPMI applications more
than
64 Mbyte of virtual memory, no matter how much real memory or swap space
is available.
------------------------------------------------------------------------------
Kevin Ashley                                       K DOT Ashley AT Ulcc DOT ac DOT uk
Special Projects Manager            
http://www.ulcc.ac.uk/staff/Kevin+Ashley
ULCC                        ...ukc!ncdlab!K.Ashley (but probably not any
more)
                      This is not a signature

- Raw text -


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