Fully featured low overhead profiler for Java EE and Java SE platforms.
Ultimate profiling and monitoring solution for Gradle, Maven, Ant, JUnit and TestNG.
Easy to use performance and memory profiler for .NET framework.

MemProfiler: Statics & Function local variables not found

Moderators: Vladimir Kondratyev, Anton Katilin

MemProfiler: Statics & Function local variables not found

Postby Alois » Mon Aug 24, 2009 12:04 pm

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
Alois
 
Posts: 2
Joined: Fri Oct 31, 2008 12:08 pm

Re: MemProfiler: Statics & Function local variables not found

Postby Anton Katilin » Tue Aug 25, 2009 1:28 pm

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
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: MemProfiler: Statics & Function local variables not found

Postby Alois » Thu Sep 10, 2009 7:25 am

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
Alois
 
Posts: 2
Joined: Fri Oct 31, 2008 12:08 pm

Re: MemProfiler: Statics & Function local variables not found

Postby Anton Katilin » Thu Sep 10, 2009 9:14 am

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
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am


Return to .NET Profiler

Who is online

Users browsing this forum: No registered users and 4 guests

cron