<aside> 📎 ITEM7 다 쓴 객체 참조를 해제하라

</aside>

Garbage Collector

Person person = new Person();
person.setName("Mang");

// garbage 발생
person = new Person();
person.setName("MangKyu");

메모리 누수

public Object pop() {
	if(size==0) throw new EmptyStackException();
	return elements[--size];
}
public Object pop() {
	if(size==0) throw new EmptyStackException();
	Object result = elements[--size];
	elements[size] = null;
	return result;
}

해결 방법(1) : null 처리