äThree
ways memory is allocated
äStatic
äAllocated
as soon as execution begins
äLasts
until termination
äUsually
reside in fixed data segments
äNote:
a variable can be static yet have a local scope
äLocal
äCreated on the stack or in a register when an enclosing block
or function is entered
äDisappear
when the block or function is exited
äDynamic
äCreated and destroyed by specific function calls during a
program
äCan
be called by application source or the runtime
äOperations:
malloc or new, and free or delete
äHow
does dynamic memory allocation work?
äUse
a datatype we call a heap