First, to understand the basics of what is going on, you need to understand how ruby stores objects internally.