Tuesday, April 19, 2011

Java memory frames

Java Frames are a particularly important concept. Here's are a few bullet point definitions of a Java Frame:

  • A frame is used to store data and partial results, as well as to perform dynamic linking, return values for methods, and dispatch exceptions.
  • A new frame is created each time a method is invoked. A frame is destroyed when its method invocation completes.
  • Frames are allocated from the JVM stack of the thread creating the frame. Each frame has its own array of local variables, its own operand stack, and a reference to the runtime constant pool of the class of the current method.
  • The sizes of the local variable array and the operand stack are determined at compile time and are supplied along with the code for the method associated with the frame.
  • Only one frame, the frame for the executing method, is active at any point in a given thread of control. This frame is referred to as the current frame, and its method is known as the current method. The class in which the current method is defined is the current class.
  • A frame ceases to be current if its method invokes another method or if its method completes.
  • A frame created by a thread is local to that thread and cannot be referenced by any other thread.

There's more than this to know about Java Frames, but I tried to whittle the Sun description down to make it easier to digest initially.

No comments:

Post a Comment

Chitika