Run Time Storage
Run Time Storage
• one pointer for each array (fixed num- • static or own variables
ber) points to the beginning of the – usually placed in static area (global)
array
– Algol 60 allows own vars for dy-
• now push variable-sized space onto namic arrays
AR local to procedure – severe difficulties with implemen-
• push and pop with the rest of the tation
AR
• Coroutines Displays
– Ada and Modula-2 • What if the number of ARs exceeds
– each process must have its own the number of available registers?
stack • each process has a static nesting level
– allocate entire stacks by heap al- determined by the structure of the
location program
• only one process at any nesting level
can have its vars accessed
• allocate one register for each nesting
level (may need a max nesting level)
Ignore Implicit
• ok if most objects stay in use and • garbage collection
memory is large • many schemes
• program can maintain a free list of – single reference
disposed objects that can be reused
when a request for space is made – reference count
– mark and sweep
• well studied
Garbage Collection Strategies • mark and sweep
• single reference – follow all pointers and recursively
mark all accessible heap objects
– require no more than one refer-
ence (pointer) to any heap object – any object not marked can be freed
– if the reference is changed, free – sweep thru the heap, collect un-
the heap object marked objects, clear marks
– complex
– fairly easy to implement
– invoked only when needed
– ok for strings, but not links
– good for Lisp
– may have a compaction phase