public MemoryManager(int totalcharsize, int totalshortsize) { globalcharacters = new char[totalcharsize]; globalshorts = new ushort[totalshortsize]; totalchunks_characters = totalcharsize / chunksize_characters; totalchunks_shorts = totalshortsize / chunksize_shorts; thresholdchunk_characters = (int)((1 - reservedshare) * totalchunks_characters); thresholdchunk_shorts = (int)((1 - reservedshare) * totalchunks_shorts); //fill queues freechunks_characters = new ConcurrentQueue <int>(); reservedchunks_characters = new ConcurrentQueue <int>(); for (int i = 0; i < thresholdchunk_characters; i++) { freechunks_characters.Enqueue(i); } for (int i = thresholdchunk_characters; i < totalchunks_characters; i++) { reservedchunks_characters.Enqueue(i); } freechunks_shorts = new ConcurrentQueue <int>(); reservedchunks_shorts = new ConcurrentQueue <int>(); for (int i = 0; i < thresholdchunk_shorts; i++) { freechunks_shorts.Enqueue(i); } for (int i = thresholdchunk_shorts; i < totalchunks_shorts; i++) { reservedchunks_shorts.Enqueue(i); } //declare memory map TPmemorymap = new ConcurrentDictionary <int, singleTPmemorymap>(); TPrunning = new ConcurrentDictionary <int, bool>(); memlock = new object(); initmemlock = new object(); releaselock = new object(); net35lock = new object(); priorityqueue = -1; memstats = new memorystats(); memstats.overflow = 0; memstats.reserveincidents = 0; }
public MemoryManager(int totalcharsize, int totalshortsize) { globalcharacters = new char[totalcharsize]; globalshorts = new ushort[totalshortsize]; totalchunks_characters = totalcharsize / chunksize_characters; totalchunks_shorts = totalshortsize / chunksize_shorts; thresholdchunk_characters = (int)((1 - reservedshare) * totalchunks_characters); thresholdchunk_shorts = (int)((1 - reservedshare) * totalchunks_shorts); //fill queues freechunks_characters = new ConcurrentQueue<int>(); reservedchunks_characters = new ConcurrentQueue<int>(); for (int i = 0; i < thresholdchunk_characters; i++) { freechunks_characters.Enqueue(i); } for (int i = thresholdchunk_characters; i < totalchunks_characters; i++) { reservedchunks_characters.Enqueue(i); } freechunks_shorts = new ConcurrentQueue<int>(); reservedchunks_shorts = new ConcurrentQueue<int>(); for (int i = 0; i < thresholdchunk_shorts; i++) { freechunks_shorts.Enqueue(i); } for (int i = thresholdchunk_shorts; i < totalchunks_shorts; i++) { reservedchunks_shorts.Enqueue(i); } //declare memory map TPmemorymap = new ConcurrentDictionary<int, singleTPmemorymap>(); TPrunning = new ConcurrentDictionary<int, bool>(); memlock = new object(); initmemlock = new object(); releaselock = new object(); net35lock = new object(); priorityqueue = -1; memstats = new memorystats(); memstats.overflow = 0; memstats.reserveincidents = 0; }