Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.msdos.programmer > #1399

Re: huge memory model, malloc() and sytem()

From Ross Ridge <rridge@csclub.uwaterloo.ca>
Newsgroups comp.os.msdos.programmer
Subject Re: huge memory model, malloc() and sytem()
Date 2014-06-03 18:49 -0400
Organization University of Waterloo
Message-ID <lmljdt$26o$1@rumours.uwaterloo.ca> (permalink)
References <9911df63-7d19-43ad-852e-0d651a75ebec@googlegroups.com> <op.xgvilgmk6zenlw@localhost> <9a0cee00-56f3-489b-963a-95752cbdaafe@googlegroups.com>

Show all headers | View raw


Alexei A. Frounze <alexfrunews@gmail.com> wrote:
>Can you help solving this particular problem and not another, unspoken one?

Ahem.

I believe most 16-bit compilers set the max memory required in the EXE
header to FFFFh so that all of conventional memory (or at least the
largest contiguous chunk) was allocated to the program at start up.
However, the startup code would then resize this initial allocation to
the size actually needed.

After that I'm not entirely sure how memory allocation was handled.
Near mallocs were allocated out of a heap maintained by the C runtime by
necessity, but I wouldn't be surprised if in at least some implementations
far mallocs weren't managed by the C runtime and just called the MS-DOS
allocation routines each time memory was allocated or freed.

It looks like Borland C manages its own far heap, but it allocates memory
from DOS as needed.  It doesn't allocate all of memory at startup.

If I were you I wouldn't worry about the overhead of MCBs and just punt
to MS-DOS for your far heap implementation.  I'd only implement my own
heap if the overhead proved to be significant enough problem in practice.

					Ross Ridge

-- 
 l/  //	  Ross Ridge -- The Great HTMU
[oo][oo]  rridge@csclub.uwaterloo.ca
-()-/()/  http://www.csclub.uwaterloo.ca/~rridge/ 
 db  //	  

Back to comp.os.msdos.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

huge memory model, malloc() and sytem() "Alexei A. Frounze" <alexfrunews@gmail.com> - 2014-06-03 01:01 -0700
  Re: huge memory model, malloc() and sytem() "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-06-03 06:11 -0400
    Re: huge memory model, malloc() and sytem() "Alexei A. Frounze" <alexfrunews@gmail.com> - 2014-06-03 03:46 -0700
      Re: huge memory model, malloc() and sytem() Ross Ridge <rridge@csclub.uwaterloo.ca> - 2014-06-03 18:49 -0400
      Re: huge memory model, malloc() and sytem() "Rod Pemberton" <dont_use_email@xnothavet.cqm> - 2014-06-04 03:14 -0400

csiph-web