Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

malloc with small data

9 views
Skip to first unread message

muta...@gmail.com

unread,
Nov 24, 2022, 4:19:48 AM11/24/22
to
How did people support malloc() requests in the
tiny/small/medium memory models?

Did the executable in the header ask for memory
beyond SP, perhaps filling out to the 64k boundary,
and then at startup, see how much memory you
managed to get, and only release stuff above the
64k boundary, and then service malloc requests
from within that space?

Currently in PDPCLIB I only support malloc for
compact/large/huge and go directly to the OS
to obtain it rather than link in my own memory
management routines.

Thanks. Paul.

Alexei A. Frounze

unread,
Nov 27, 2022, 2:04:02 AM11/27/22
to
Tiny memory model .COMs get all the memory, which can be less
or more than 64KB. I simply resize the block to 64KB and move SP
to its end (if the resizing fails, the .COM terminates with error).
The library manages the heap space between the static
variables and the stack.
My small memory model .EXEs don't resize anything as they
always get the minimum specified in the header, which is
set to a value that guarantees a full 64KB data/stack segment.
The library manages the heap space the same way.

Alex
0 new messages