ln020 - Memory Management For most programming languages...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Memory Management For most programming languages memory management has two parts: (1) Static - global data, compiled code, runtime system (2) Dynamic - runtime stack (activation record stack), heap (!) Chap. 14
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Typical Memory Layout A typical memory layout for languages such as C and Java Heap Manager Stack Pointer 0 FF. .FF static dynamic Compiled code, RTS, Library code Global data Heap Runtime stack NOTE: if the runtime stack and the heap meet out of memory
Background image of page 2
The Heap Runtime systems allocate dynamically created objects on the heap by a call to the heap manager . In Java the heap manager is called with the new keyword. In C the heap manager is called using the malloc function. Observation : In languages like Java and ML heap memory is reclaimed by the heap manager automatically via garbage collection when it is no longer used. In C the programmer has to explicitly manage heap memory with malloc/free function calls. This is error prone and leads to the (in)famous dangling pointer reference (free called too early) and the memory leak (free never called) problems.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

ln020 - Memory Management For most programming languages...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online