private static ObjectTable AddThreadLocalTable() { Debug.Assert(t_threadLocalCounts == null); var localCounts = new ObjectTable(); t_threadLocalCounts = localCounts; lock (s_allTables) { var allTables = s_allTables; if (s_allTablesCount >= allTables.Length) { var newAllTables = new ObjectTable[allTables.Length << 1]; allTables.CopyTo(newAllTables, 0); s_allTables = newAllTables; allTables = newAllTables; } allTables[s_allTablesCount++] = localCounts; } return localCounts; }