private void mostAllocatedBlocksToolStripMenuItem_Click(object sender, EventArgs e) { MostAllocatedForm mostAllocated = new MostAllocatedForm(); InitAllocationOverview(mostAllocated, 50); mostAllocated.InitLargestBlocks(m_memOperations, 50); mostAllocated.Sort(); mostAllocated.ShowDialog(); }
void InitAllocationOverview(MostAllocatedForm frm, int maxEntries) { int[] mostAllocated = new int[maxEntries]; for (int i = 0; i < maxEntries; ++i) { mostAllocated[i] = -1; } for (int i = 0; i < m_mostAllocatedBlocks.Length; ++i) { int numBlocks = m_mostAllocatedBlocks[i]; int smallestIdx = SmallestEntry(mostAllocated); if (mostAllocated[smallestIdx] < 0 || numBlocks > m_mostAllocatedBlocks[mostAllocated[smallestIdx]]) { mostAllocated[smallestIdx] = i; } } for (int i = 0; i < maxEntries; ++i) { if (mostAllocated[i] >= 0) { frm.AddMostAllocatedEntry(mostAllocated[i], m_mostAllocatedBlocks[mostAllocated[i]]); } } }