private CachingCollector(Collector other, double maxRAMMB, bool cacheScores) { this.Other = other; CachedDocs = new List<int[]>(); CurDocs = new int[INITIAL_ARRAY_SIZE]; CachedDocs.Add(CurDocs); int bytesPerDoc = RamUsageEstimator.NUM_BYTES_INT; if (cacheScores) { bytesPerDoc += RamUsageEstimator.NUM_BYTES_FLOAT; } MaxDocsToCache = (int)((maxRAMMB * 1024 * 1024) / bytesPerDoc); }