TPALLOC - Routines for allocating blocks of memory
larger than 64K
------------------------------------------------------------------
Brian Foley
TurboPower Software
Compuserve [76317,3247]
11/88
Version 1.0
Released to the public domain
Overview
------------------------------------------------------------------
TPALLOC contains routines that allow you to allocate and
deallocate blocks of memory larger than 64K using Turbo Pascal
4.0 or 5.0. Whether or not these routines will be of use to you
is hard to say. On the one hand, their usefulness is severely
limited by the fact that Turbo Pascal does not allow you to
declare data structures larger than 64K (actually 65521 bytes).
So it will be up to you to manipulate huge data structures
allocated with TPALLOC. On the other hand, we know these
routines *can* be useful in some cases. After all, we wrote them
because we needed them for our own software. In any event, we
didn't feel any overwhelming need to keep these routines to
ourselves, and you are welcome to use them if you can.
See DEMO.PAS for a demonstration of how to use TPALLOC.
Using TPALLOC
------------------------------------------------------------------
TPALLOC interfaces the following types and procedures:
type
SegOfs =
record
Ofst, Segm : Word;
end;
This record structure is used to separate a 32-bit pointer into
its component parts.
procedure HugeGetMem(var Pt; Bytes : LongInt);
This routine allocates a block of memory of size Bytes and
stores a pointer to it in Pt (a pointer variable of some sort).
Pt will be set to nil if Bytes > MaxAvail. HugeGetMem is
essentially identical to GetMem except that it can allocate
blocks of memory larger than 64K. (It can also allocate blocks
less than 64K, of course.)
procedure HugeFreeMem(var Pt; Bytes : LongInt);
This routine deallocates a block of memory of size Bytes
pointed to by Pt (a pointer variable of some sort). Pt is set
to nil on
|