Here, we program keeps myBuffer around as long as MainStuff lives which can be very long if it is, say, a main class of your program.
It's just that the cases where the memory is kept around are not as easy for the programmer to spot as this example for reference-hierarchies are deeper.
What it won't help with are cases like: public class MainStuff { private byte[] myBuffer;
Here, we program keeps myBuffer around as long as MainStuff lives which can be very long if it is, say, a main class of your program.It's just that the cases where the memory is kept around are not as easy for the programmer to spot as this example for reference-hierarchies are deeper.