[TUHS] Memory management in Dennis Ritchie's C Compiler

Dibyendu Majumdar mobile at majumdar.org.uk
Tue Aug 18 07:29:38 AEST 2020


On Mon, 17 Aug 2020 at 21:16, Dibyendu Majumdar <mobile at majumdar.org.uk> wrote:

> Memory can be used for declarations, trees (for expressions) and
> strings as far as I can tell. Strings actually use the tree
> allocation, and just pretend that a node is a string.
> It seems that tree memory is allocated in a stack discipline. But what
> puzzled me is that when a tree starts, about 512 bytes of memory are
> left as gap for declarations to use. I have been trying to think in
> what circumstances would you encounter a declaration while parsing an
> expression - perhaps cast expressions? Anyway - if a declaration
> occurs inside an expression (i.e. tree) then it only has 512 bytes
> available. Of course this could be made bigger ... but at the least I
> would like to have separate heaps for declarations, trees and strings.
>

Okay it seems those are undefined symbols encountered in an
expression. Symbols use the same allocation function as declarations.

Regards
Dibyendu


More information about the TUHS mailing list