next up previous
Next: The Memory Model: The Up: More on Methods Previous: Passing Values Out

The Memory Model: What's ``Really'' Going On

We've previously illustrated what memory roughly 'looks like' when we define a class and instantiate an object. This view of memory is called the Memory Model, and is a tool to help understand how the language works. A more detailed (as detailed as we'll get in this course) view of memory consists of the run-time stack, static space, and object space. Static space contains memory allocated for class definitions, object space contains memory allocated for instantiated objects, while the run-time stack contains memory allocated for the currently running method(s).

Figure 3: A snapshot of the memory model during execution of a program.
\begin{figure}
\begin{center}
\epsfxsize =7.5in {\epsfbox {memmodel.ps}} \\
\end{center}\end{figure}

As mentioned above, the memory model refers to three distinct areas in memory: the run-time stack, static space, and object space. Note that for a particular class (say Student) there will only ever be one piece of static space allocated. On the other hand, object space will contain a piece of memory for each object of that class that is instantiated


next up previous
Next: The Memory Model: The Up: More on Methods Previous: Passing Values Out
Chris Trendall
Copyright ©Chris Trendall, 2001. All rights reserved.

2001-12-09