Whiteship
  • Home
  • 인프런 강의
  • Java
  • Spring
  • JPA
  • SDE Tips
Subscribe

객체 크기

A collection of 1 post
객체 크기

객체 크기 구하기

Object 클래스에 size() 라는 메소드가 없습니다. 그럼 객체의 크기를 알 수 없을까요;; 약간 돌아가면 알 수 있습니다. Runtime 이라는 클래스를 사용하여 힙 영역의 크기를 재면 됩니다. public class Size { public static void main(String[] args) { System.gc(); Runtime r = Runtime.getRuntime(); System.out.println(“전체 힙 메모리” + r.totalMemory()); long
Aug 14, 2007 — 2 min read
Whiteship © 2022
Powered by Ghost