What are the differences between the Java memory spaces (Perm Space, Space Stack, Heap Space)? When does the JVM use one or another? If I use Scala/Groovy/etc., are there differences?