Newsgroups: comp.os.msdos.programmer
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!magnus.acs.ohio-state.edu!usenet.ins.cwru.edu!cwlim!trier
From: trier@cwlim.INS.CWRU.Edu (Stephen C. Trier)
Subject: Re: Porting software to the PC, 64K data structure barrier.
Message-ID: <1991Jun30.075809.15414@usenet.ins.cwru.edu>
Sender: news@usenet.ins.cwru.edu
Nntp-Posting-Host: cwlim.ins.cwru.edu
Reply-To: trier@po.CWRU.Edu
Organization: Case Western Reserve Univ. Cleveland, Ohio, (USA)
References: <1972@contex.contex.com> <1991Jun29.203704.8443@uwasa.fi> <PSHUANG.91Jun30005831@w20-575-108.mit.edu>
Date: Sun, 30 Jun 91 07:58:09 GMT
Lines:       36

In article <PSHUANG.91Jun30005831@w20-575-108.mit.edu> pshuang@athena.mit.edu (Ping-Shun Huang) writes:
>I think the following table is correct:

No, it is not quite correct.  In any memory model except tiny, one may
allocate _heap_ data objects larger than 64K by using the "huge" keyword.
Your static data items (anything but "auto" and malloced space) is limited
to 64k or less in every memory model but huge.  In huge, it is limited to
64k per source file.  Again, this "huge" keyword works in the small, medium,
compact, large, and huge memory models.  It looks and acts just like a far
pointer.  It's just slower.

[Editorial: I am told that Microsoft has a mechanism that allows the
allocation of huge static (not malloced) data items.  Borland may also
have such a mechanism.  I have never bothered checking, because my programs
tend more towards mallocing space as needed.]

Huge memory model does _not_ imply huge pointers.  The overhead of a huge
pointer is very large, so making it the default in huge model would cripple
huge-model programs.  This behavior is identical in Microsoft and Borland
compilers.

If you are tight on space, you might want to try using a _smaller_ memory
model.  My experience has been that most programs that fit in MS-DOS at all
will fit in a small, compact, or large memory model, depending on how much
data and code is needed.  The difference in size between small and huge
models may be a factor of two or more, so moving to a smaller memory model
(if possible) may actually increase your available memory.  Likewise, the
smaller memory models run much faster than the larger ones.  The huge model
is especially slow.

-- 
Stephen Trier                       "48 61 70 70 69 6e 65 73 73 20 69 73 20 61
Server Surgery Group                 20 77 61 72 6d 20 68 65 78 20 64 75 6d 70
Information Network Services         21 20 20 3b 2d 29"     - Me
Case Western Reserve University               Mail: trier@ins.cwru.edu
