
What does [garbage collection] mean in this figure? And the thing "20 calls"?
I mean, how can I understand why GC takes so long? Was it going to collect many small items? Is one big? Any tips on how to optimize this at all?
This code:
private void DeserializeFrom(SerializationInfo info)
{
Width = info.GetInt32("width");
Height = info.GetInt32("height");
var data = (List<byte>)info.GetValue("cells", typeof(List<byte>));
cells = new Cell[physicalSize.Width, physicalSize.Height];
int pos = 0;
for (int x = 0; x < physicalSize.Width; x++)
{
for (int y = 0; y < physicalSize.Height; y++)
{
cells[x, y] = new Cell();
if (x < Width && y < Height)
{
cells[x, y].HasCar = data[pos];
pos++;
}
}
}
}
Nothing special. I suspect that the culprit is a large object List<byte>, but I thought that collecting one large object should be instantaneous (as opposed to collecting a heap of small objects).
source
share