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.

YourKit 2013 and System.String Object Explorer View

Moderators: Vladimir Kondratyev, Anton Katilin

YourKit 2013 and System.String Object Explorer View

Postby JeremyK » Thu May 29, 2014 1:48 pm

The "Object Explorer" view seems to not display information about System.String objects correctly.

(Excuse the ASCII art):

Name Retained Size Shallow Size
tableNamespace System.String 18 18
m_arrayLength = Int32 1920298841 0x72756F59
m_firstChar = Char '丮' '\u4E2E' 2
m_stringLength = Int32 544500043 0x2074694B 4

Clearly, the length of my string isn't 0x2074694B.

Seems like the profiler needs some 'special case' code to deal with System.String (my understanding is that the characters are actually stored 'inside' the object, and the "m_firstChar" field is, so to speak, the "last" field in System.String, whose address is the start of the character string. (I've also read somewhere where .Net 4.0 changed this some (above example is from .Net 2.0)).

This is a .Net 4.0 example: https://gist.github.com/rednaxelafx/7244863

This is for .Net 2.0, but also contains a comment about m_arrayLength not being present in 4.0:
http://stackoverflow.com/questions/5240 ... ring-value

Thanks,

Jeremy
JeremyK
 
Posts: 7
Joined: Wed May 28, 2014 8:45 pm

Re: YourKit 2013 and System.String Object Explorer View

Postby Anton Katilin » Thu May 29, 2014 2:39 pm

Hi Jeremy

Thank you for reporting this issue.

We have managed to reproduce the problem with v2013.
In our tests, we see always one string per snapshot with such incorrect fields. How many bad string do you see?

Anyway, we can't reproduce the problem with the latest code base which will eventually become the next version, 2014. Perhaps it was fixed as a side effect of other improvements and fixes we have made since v2013.

Could you please try running profiled applications with the following build based on the latest source code:
http://www.yourkit.com/download/tmp/201 ... -14502.exe

Do you still see the problem with it?

Best regards,
Anton
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: YourKit 2013 and System.String Object Explorer View

Postby JeremyK » Thu May 29, 2014 3:56 pm

Hello,

>>>
In our tests, we see always one string per snapshot with such incorrect fields. How many bad string do you see?
<<<

Interesting, yes, that appears to be the case (1 per snapshot). (The particular "bad" display will occur more than once, if that same String object is referenced by multiple fields, though.).

>>>
Could you please try running profiled applications with the following build based on the latest source code:
<<<

If I open an "old" (from 2013) snapshot with the new code, I see the same bad string.

However, so far, recording/profiling with the new code appears to work correctly.

Thanks,

Jeremy
JeremyK
 
Posts: 7
Joined: Wed May 28, 2014 8:45 pm

Re: YourKit 2013 and System.String Object Explorer View

Postby Anton Katilin » Thu May 29, 2014 4:03 pm

Thanks for testing.

If I open an "old" (from 2013) snapshot with the new code, I see the same bad string.

The wrong information is contained in the snapshot, so it's expected that opening the old snapshot with the new UI doesn't solve the problem, and that it's required to re-run with the new agent to obtain a new, correct snapshot.

However, so far, recording/profiling with the new code appears to work correctly.


Great. We'll investigate whether we can safely backport the necessary fixes to v2013.
Meanwhile, you can use the v2014 build. We are not aware of any regressions.
Anton Katilin
 
Posts: 5575
Joined: Wed Aug 11, 2004 8:37 am

Re: YourKit 2013 and System.String Object Explorer View

Postby JeremyK » Thu May 29, 2014 5:19 pm

One thing I notice is (using the 2014 build) is that it appears that non-empty strings display as so:

[44] System.String "eutestt" 32 32

But that empty strings display as expandable

_columnUri System.String 18 18
m_arrayLength = Int32 0 4
m_firstChar = Char '<displays as square box>' '\u0000'
m_stringLength = Int32 0 4

I'm not sure if that is intentional, or perhaps some sort of side effect of String.Empty?

Regards,

Jeremy
JeremyK
 
Posts: 7
Joined: Wed May 28, 2014 8:45 pm

Re: YourKit 2013 and System.String Object Explorer View

Postby JeremyK » Thu May 29, 2014 5:34 pm

Please disregard the previous message -- I had confused myself by opening up an old snapshot.

Regards,

Jeremy
JeremyK
 
Posts: 7
Joined: Wed May 28, 2014 8:45 pm


Return to .NET Profiler

Who is online

Users browsing this forum: No registered users and 2 guests