Runtime.
As Java is executed by a VM
, it does not make sense allocating memory at compile time.
'Local variables' like function arguments or variables inside a function are only 'allocated' on the stack (primitive value or reference). Objects are always created on the heap.
But: everything concerning memory management (allocation, deallocation, garbage-collection) is JVM
implementation dependent and happens only at runtime (except for primitive and String constants of course).