Replies: 1 comment
|
exception 같은 경우는 인스턴스 생성 후, 사용 즉시 바로 가비지 컬렉션 대상이 됨으로 static으로 정적 선언을 해도 메모리가 효율적으로 개선되는 부분은 없을 거라 생각합니다. 또한, 정적 선언으로 싱글톤으로 예외 객체를 재사용하면, 해당 예외 인스턴스를 처음 생성한 시점의 스택 트레이스만 남고, 이후에 throw 할 때마다 새로 캡처되지 않아 문제가 생길 것 같습니다. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
커스텀 Exception 객체 static으로 공유하기 vs new Exception 생성하기
All reactions