Loading lesson…
Level 1 · Apprentice0 XP
Where your variables and objects really live, and who cleans them up.
Step 1 / 6
ProblemYou write val user = User("Ada"). There is a variable and there is an object. They do not live in the same place.
← → step
Before this: From your code to the CPU
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Draw (on paper) the stack and heap for a function that creates two Users and puts one in a global list. Then mark which object the GC can free after the function returns.