MemProfiler: Statics & Function local variables not found

Questions about YourKit .NET Profiler
Post Reply
Alois
Posts: 2
Joined: Fri Oct 31, 2008 12:08 pm

MemProfiler: Statics & Function local variables not found

Post by Alois »

Hi given this very simply program:

Code: Select all

    class Program
    {

        static byte[] myStaticObjects = new byte[100 * 1000 * 1000];

        static void Main(string[] args)
        {
            byte[] array = new byte[50 * 1000 * 1000];
            Console.ReadLine();
            array[0] = 10;
        }
    }
I still cannot find out even with the YourKit 4.1 profiler where I have to search. The profiler displays array as stack local and the static member variable myStaticObjects simply as byte array in the memory overview without any hint where I should start my search. This is rather unfortunate since these cases can occur quite frequently.

Yours,
Alois Kraus
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: MemProfiler: Statics & Function local variables not found

Post by Anton Katilin »

Hello,

Could you please provide more detail on what you are looking for.

Is it right that you watch "Biggest objects (Dominators)" view?

If so, select an object in the master (i.e. upper) table and appropriate slave view below.

In particular, "Paths" slave view which is shown by default will show paths to the selected object, which describes why the object is retained in memory. More about paths: http://www.yourkit.com/docs/net40/help/paths.jsp

For array "new byte[50 * 1000 * 1000]" there will be no path, because it is only accessible from a local variable. Unfortunately, it's technically impossible to explicitly obtain this information. However, you can consider allocation recording feature introduced in version 4.1:
http://www.yourkit.com/dotnet/eap/
http://www.yourkit.com/docs/net41/help/allocations.jsp
It allows to learn where objects are created.

Best regards,
Anton
Alois
Posts: 2
Joined: Fri Oct 31, 2008 12:08 pm

Re: MemProfiler: Statics & Function local variables not found

Post by Alois »

Yes I was looking for the GC roots. I was not aware that after setting it to 10 shorted paths my static member of Program shows up! Thanks that really helps me a lot to diagnose problems with global statics. Your profiler is really one of the best out there. Especially the stack traces and live performance counter view is an invaluable tool to better troubleshoot misbehaving applications.


Yours,
Alois Kraus
Anton Katilin
Posts: 6172
Joined: Wed Aug 11, 2004 8:37 am

Re: MemProfiler: Statics & Function local variables not found

Post by Anton Katilin »

Hello Alois

Thank you for the kind words.

If you have not tried it yet, please take a look at recently released version 4.5. Changes: http://www.yourkit.com/dotnet/changes/index.jsp

Best regards,
Anton
Post Reply