delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/24/00:43:22

Date: Tue, 23 Aug 94 22:57:36 EDT
From: peprbv AT cfa0 DOT harvard DOT edu (Bob Babcock)
To: ele AT clients DOT switch DOT ch
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: DJGPP problems
Reply-To: babcock AT cfa DOT harvard DOT edu

I think I understand what is going on, but I am cc'ing this to the djgpp list
for general comment.

Problem summary:
  A test program malloc's several equal sized hunks of memory.  The free
memory available drops when the program runs, but by less than the amount of
memory allocated.  Behavior is somewhat different under xms and dpmi, but
both seem to fail.

Suggested explanation:
  When memory is malloc'ed, an entry is made in a descriptor table, but
physical memory isn't actually allocated until you generate a page fault by
referencing the memory.  Malloc puts some info at the beginning of a block,
so some of the memory is touched immediately, and small blocks seem to work
while large ones fail.  Evidence for this conjecture is that if the test
program uses calloc (which zeroes allocated memory) rather than malloc, the
reported physical memory available does decrease by more than the amount
allocated. 

Comments anyone?

- Raw text -


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