Presentation is loading. Please wait.

Presentation is loading. Please wait.

Storage Bindings Allocation is the process by which the memory cell or collection of memory cells is assigned to a variable. These cells are taken from.

Similar presentations


Presentation on theme: "Storage Bindings Allocation is the process by which the memory cell or collection of memory cells is assigned to a variable. These cells are taken from."— Presentation transcript:

1 Storage Bindings Allocation is the process by which the memory cell or collection of memory cells is assigned to a variable. These cells are taken from a pool of available memory. Deallocation is the process of returning a memory cell or collection, that has been unbound from a variable, back into the pool of available memory.

2 Lifetime of a variable Lifetime is the period of time during which the variable is bound to a specific memory location. It begins when the variable is bound to the memory cell, and ends when it is unbound from that memory cell.

3 Static variables A static variable is bound to its memory cell before program execution begins and remains bound to that cell until program execution ends. Examples: 1. all global variables in C 2. local static variables in C that are history-sensitive; they retain values between executions of the function.

4 Stack-Dynamic Variables Stack dynamic variables (semi-static) are those whose storage bindings are created when their declaration statements are “elaborated” during runtime, but whose types are statically bound at compile time. Example: 1. local variables within functions in C

5 Semi-Dynamic Stack Variables Semi-dynamic stack variables are those whose storage bindings are created during runtime when their declaration statements are elaborated, whose types are statically bound at compile time, but whose size are known only at runtime. Examples: 1. local arrays with variable size in GCC 2. variables allocated with alloca() in GCC

6 Explicit Heap-Dynamic Variables Explicit heap-dynamic variables are nameless memory cells that are allocated and deallocated by explicit function calls such as malloc() or new and free() or delete, specified by the programmer during runtime. Used for creating dynamically growing runtime data structures in memory.

7 Implicit Heap-Dynamic Variables Implicit heap-dynamic variables are bound to heap storage when they are assigned values, at which time all their attributes are also assigned to the variable. Used in programming languages where variables have dynamic types, such as in Haskell and Lisp.


Download ppt "Storage Bindings Allocation is the process by which the memory cell or collection of memory cells is assigned to a variable. These cells are taken from."

Similar presentations


Ads by Google