Java freeMemory()和totalMemory()之间的差异

Java freeMemory()和totalMemory()之间的差异,java,Java,freemory()和totalMemory()之间有什么区别?两者都是JVM当前可用的内存总量 /** * * @return an approximation to the total amount of memory currently * available for future allocated objects, measured in bytes. */ public native long freeMem

freemory()
totalMemory()
之间有什么区别?两者都是JVM当前可用的内存总量

    /**
     *
     * @return  an approximation to the total amount of memory currently
     *          available for future allocated objects, measured in bytes.
     */
    public native long freeMemory();

    /**
     *
     * @return  the total amount of memory currently available for current
     *          and future objects, measured in bytes.
     */
    public native long totalMemory();
freemory()
表示未来的
totalMemory()
表示当前和未来的

从字面上看,
freemory()
告诉新分配对象的内存,
totalMemory()
告诉总内存(已分配的内存+可用内存)

这是关于“未来”与“当前和未来”FreeStaturdayTime()-本周六可工作的小时数(尚未计划!),TotalSaturdayday()-本周六你将醒着的小时数(不要超过你的另一半/猫已经决定的时间熬夜!)。