负空闲记忆 [英] Negative Free Memory

查看:117
本文介绍了负空闲记忆的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时,此代码会打印一个负数,例如-64。
该值以KB为单位。

Sometimes, this code prints a negative number, like -64. The value is in KB.

可能会发生什么?



long memoriaInicial = Runtime.getRuntime().freeMemory() / 1024;
sort(vector);
System.Out.Println(memoriaInicial - Runtime.getRuntime().freeMemory()/1024);


推荐答案

这意味着在您排序后垃圾收集器可能已经释放了更多的内存,而且你拥有的内存比你开始时要多。

It means after you've sorted, the garbage collector has probably freed more memory and you have more than you started out with.

这篇关于负空闲记忆的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆