When writing programs it’s always good to know what’s happing in the core of the Framework you’re using. This allow you to get a better idea why things happen in a certain way or what to do in case you receive an error.
So if you’re a java programmer a good thing to read is this paper on memory management in the Virtual machine. It has a short introduction, a brief overview of the concepts and later on it dives a little deeper with an overview on the different garbage collectors and a chapter on ergonomics. At the end you get some tips and recommendations.
Chapter 6 also contains the paragraph ‘What to Do about OutOfMemoryError’ helpful for us all I think :-) (especially when you’ve ever have used BufferedImage)
Here you can find more information on Java HotSpot Garbage Collection.