[alt.msdos.programmer] Using Extended Memory without dereference operator

raymond@ptolemy.arc.nasa.gov (Eric A. Raymond) (05/09/89)

I would like to use extended memory via a malloc-like function.  I
know of one method.  Unfortunately, it requires that you use a
dereferencing operation in order to access the allocated block.

i.e.
         x = ext_malloc(sizeof(THING));
         .
         .
         .
         *(THINGPTR) x = y;            /* What I would like to do */
         *(THINGPTR) ext_deref(x) = y; /* What I have to do */


You can see that the dereference requirement translates into a major
rewrite of code.

Additionally, in the system I am thinking of, the deref operator will
not guarantee the validity of its pointer beyond the next call to
deref.  Therefore it becomes very tedious to support pointers (i.e. to
structures) of pointers.  I beleive this a property of the EMS
support.  It may not be true if only extended memory is used.

Additionally, this system has 10 bytes overhead per malloc.  I don't
know what overhead a typical malloc has, but this seems extreme.
Furthermore, I believe these 10 bytes must come from low DOS (640k)
memory.

I'm using Turbo C.  It would be really nice it Borland would supply a
HUMONGOUS memory model which had this capability built in.

-- 
Eric A. Raymond  (raymond@ptolemy.arc.nasa.gov)
G7 C7 G7 G#7 G7 G+13 C7 GM7 Am7 Bm7 Bd7 Am7 C7 Do13 G7 C7 G7 D+13: Elmore James

nelson@sun.soe.clarkson.edu (Russ Nelson) (05/09/89)

This may sound like a gross kludge, but you could run in protected mode most
of the time, and only drop to DOS when you have to.  Then it's just a matter
of writing your own malloc, as you said.
--
--russ (nelson@clutx [.bitnet | .clarkson.edu])
I'm a right-to-lifer -- everyone has a right to earn a living sufficient to
feed himself and his family.

raymond@ptolemy.arc.nasa.gov (Eric A. Raymond) (05/09/89)

In article <NELSON.89May8220758@sun.soe.clarkson.edu> nelson@clutx.clarkson.edu writes:
.This may sound like a gross kludge, but you could run in protected mode most
.of the time, and only drop to DOS when you have to.

Have you tried something like this?  It seems very painful and
expensive.


-- 
Eric A. Raymond  (raymond@ptolemy.arc.nasa.gov)
G7 C7 G7 G#7 G7 G+13 C7 GM7 Am7 Bm7 Bd7 Am7 C7 Do13 G7 C7 G7 D+13: Elmore James