tags:

views:

373

answers:

4

I'm interested in how java organizes memory and executes code (like what gets put in the stack or the heap), from the start of main, to assigning variables, calling functions, passing parameters, returning values, instantiating objects, etc. Has anyone found a good, beginner-friendly article/reference on it? Preferably online, of course, but any suggestions or answers will be greatly appreciated. Thanks.

+3  A: 

The canonical reference is the JVM spec. However, different JVMs can implement the spec in different ways. You can also check out the open source Java platform implementation, OpenJDK.

Josh Segall
A: 

I don't know exactly how they execute their bytecode, but I found this link describing java's bytecode. I am not sure if it helps, but at least it's something to start on.

Quote:

This article gives you an understanding of Java bytecode that will enable you to be a better programmer. Like a C or C++ compiler translates source code into assembler code, Java compilers translate Java source code into bytecode. Java programmers should take the time to understand what the bytecode is, how it works, and most importantly, what bytecode is being generated by the Java compiler. In some cases, the bytecode generated is not what you expect.

Statement
+1  A: 

Sun has a pretty good article on Java memory management on the web as a PDF: memorymanagement_whitepaper

John Mulder
A: 

After more searching, I seem to have found a good article: http://www.artima.com/insidejvm/ed2/jvm.html