a heap of questions (pun intended)
Bob Calbridge
bobc at attctc.Dallas.TX.US
Sat Nov 25 12:21:18 AEST 1989
I'm a tad confused. I think I have the concept of 'heap' and 'pointers' down
but not having any experience in designing test I wouldn't be able to
guarantee that my concepts would be correct. So I'm going to state my
understanding of the situation and those of you who see a flaw in my thinking
may feel free to correct me. (please)
I'm programming in the Turbo C environment. First concept concern the 'heap'.
As I see it, the 'heap' in the small and tiny models are limited in size.
For the tiny model the _total_ size of program and data cannot exceed 64K,
meaning that the larger the code grows the less room is available in the heap.
In the small model the _total_ space for code is 64K and _total_ space for
the heap is 64K less the amount of room taken up by the data reserved for the
program (i.e. declared variables.)
Now in the larger models I figure that the space available for the heap is
all the remaining memory not used by the program, its stack and data segments.
(How am I doing so far?) Now here's the stick part (if I haven't gotten stuck
already.) If, in the larger models, memory is reserved using any of the
*alloc functions, where any one reserved memory area is less than 64K, you
would use a standard pointer declaration with no modifiers. However if the
area covers more than 64K you would declare a 'huge' pointer. If the area
is not using heap memory but something like video ram or extended memory you
would have to declare a 'far' pointer to allow the definition of a segment
in the pointer. By extension a 'huge' pointer would do the same thing but
would not be necessary for sufficiently small area. The 'huge' pointer would
slow up processing due to the need to normalize the segment value with the
offset value.
Is this all essentially correct? Did I miss anything? Are there any pitfalls
that I should look out for? Please correct me on any of this as I'll come
out better for the experience.
Thanks,
Bob
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
= I know it's petty.......... =
- But I have to justify my salary! -
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
More information about the Comp.lang.c
mailing list