Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

bugfix for 100% CPU bug; thanks to Matthias for analysis

orbiterf16f1f15cdf8
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index 569ebd5eb..552fa34bd 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -383,10 +383,14 @@ public final class plasmaWordIndex {
hashOrder.rotate(startHash.getBytes());
TreeSet hashes = new TreeSet(hashOrder);
Iterator i = wordHashes(startHash, resourceLevel, rot);
+ if (resourceLevel == plasmaWordIndex.RL_RAMCACHE) count = Math.min(ramCache.wSize(), count);
String hash;
- while ((hashes.size() < count) && (i.hasNext())) {
+ while ((count > 0) && (i.hasNext())) {
hash = (String) i.next();
- if ((hash != null) && (hash.length() > 0)) hashes.add(hash);
+ if ((hash != null) && (hash.length() > 0)) {
+ hashes.add(hash);
+ count--;
+ }
}
return hashes;
}