|
|
|
|
|
by jejones3141
4853 days ago
|
|
"heap" goes back at least to Algol 68, where you could write (using case stropping) REF INT i = HEAP INT; # sort of like C++ "new" #
REF INT i = LOC INT; # allocates from the stack # or the shorter forms HEAP INT i;
LOC INT i; |
|
Since heap is the word used in heap sort, it's fair to say that the second use of that word was a misuse. I don't know which use was second and don't really care but did want to know the details of the dynamic memory allocation used by the C malloc() and free(). I just would have appreciated an explanation of malloc() and free() were doing so that could write some code, as I described, to 'help' me monitor what my code was doing with memory. Sure, now writing a good system for 'garbage collection' complete with reference counts and memory compactification is difficult, but what malloc() and free() were doing was likely not very tricky. I just wish K&R had documented it.