memoryusage.java

来自「这个是perst-269.zip下面的SOURCECODE,和大家分享了。」· Java 代码 · 共 39 行

JAVA
39
字号
package org.garret.perst;

/**
 * Information about memory usage for the correspondent class. 
 * Instances of this class are created by Storage.getMemoryDump method.
 * Size of internal database structures (object index, memory allocation bitmap) is associated with 
 * <code>Storage</code> class. Size of class descriptors  - with <code>java.lang.Class</code> class.
 */
public class MemoryUsage {
    /**
     * Class of persistent object or Storage for database internal data
     */
    public Class cls;

    /**
     * Number of reachable instance of the particular class in the database.
     */
    public int nInstances;
    
    /**
     * Total size of all reachable instances
     */
    public long totalSize;

    /**
     * Real allocated size of all instances. Database allocates space for th objects using quantums,
     * for example object wilth size 25 bytes will use 32 bytes in the storage. 
     * In item associated with Storage class this field contains size of all allocated
     * space in the database (marked as used in bitmap)
     */
    public long allocatedSize;

    /**
     * MemoryUsage constructor
     */
    public MemoryUsage(Class cls) { 
        this.cls = cls;
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?