Author: toad
Date: 2007-03-24 19:59:32 +0000 (Sat, 24 Mar 2007)
New Revision: 12337
Modified:
trunk/freenet/src/freenet/node/NodeStats.java
Log:
Bytes free should mean bytes available to allocate, not bytes within the
current VM size.
Modified: trunk/freenet/src/freenet/node/NodeStats.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeStats.java 2007-03-24 19:56:59 UTC
(rev 12336)
+++ trunk/freenet/src/freenet/node/NodeStats.java 2007-03-24 19:59:32 UTC
(rev 12337)
@@ -332,7 +332,11 @@
Runtime r = Runtime.getRuntime();
long maxHeapMemory = r.maxMemory();
+ long totalHeapMemory = r.totalMemory();
long freeHeapMemory = r.freeMemory();
+ if(maxHeapMemory < Long.MAX_VALUE) { // would mean unlimited
+ freeHeapMemory = maxHeapMemory - (totalHeapMemory -
freeHeapMemory);
+ }
if(freeHeapMemory < MIN_FREE_HEAP_BYTES_FOR_ROUTING_SUCCESS) {
pInstantRejectIncoming.report(1.0);
return "<MIN_FREE_HEAP_BYTES_FOR_ROUTING_SUCCESS
("+SizeUtil.formatSize(freeHeapMemory, false)+" of
"+SizeUtil.formatSize(maxHeapMemory, false)+')';