java 查看类大小
// 结果数据 long gcing = Runtime.getRuntime().freeMemory(); orderList = pageOrder.getRecords(); long gced = Runtime.getRuntime().freeMemory(); // 64位打印24,32位打印16 (注:是因为JVM底层内存都是以8 byte对齐的,即8的倍数) System.out.println("Memory used:"+(gcing -gced )); long size= ObjectSizeCalculator.getObjectSize(orderList); System.out.println("Memory used:"+size);