views:

18

answers:

1

What does [Garbage collection] mean in this pic? And the "20 calls" thing?

I mean, how can I figure out why GC took so long? Was it collecting a lot of small objects? A single big one? Any hints as to how to optimize this at all?

The code in question is:

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 too fancy. I suspect the culprit is the big List<byte> object, but I thought collecting a single, big object is supposed to be instant (as opposed to collecting a bunch of small objects).

A: 

This link provides explanation of garbage collection profiling with dotTrace

Hope this helps.

Eugene Cheverda
Thanks, but no, this link is about the dotTrace Memory Profiler, which is a separate product from dotTrace Performance Profiler. One helps you make you apps take less mem, and the other lets you make them faster.
Stefan Monov