Does JProfiler Have A Reachability Scope View Like YourKit? - jprofiler

I am analysing a heap dump created by jmap.
YourKit has a "Reachability scope" which shows objects distributed according to their reachability scope, i.e. on how/whether they are reachable from GC roots
http://www.yourkit.com/docs/95/help/reachability.jsp
I am interested in seeing the "Objects unreachable from GC roots but not yet collected".
Does JProfiler have such a view?
For that matter, is there anyway to get this using jhat, VisualVM or IBM MAT?

Currently not, but I've added this for 8.1, there will be an inspection "Unreachable objects" in the heap walker.

I am not sure about inspection, but to see unreachable objects in a heap dump, check the "Customize Analysis" in the file selection dialog. Then uncheck "Perform full GC" in the analysis options.
I still don't know how to look at the set of unreachable objects, but they will be there in the full set of objects.

Related

VB Visual Studio 2017: Error Managed Debugging Assistant 'DisconnectedContext'

I got the "Managed Debugging Assistant 'DisconnectedContext' " error.
Managed Debugging Assistant 'DisconnectedContext'
Message=Managed Debugging Assistant 'DisconnectedContext' : 'Transition into COM context 0xfc94b0 for this RuntimeCallableWrapper failed with the following error: System call failed. (Exception from HRESULT: 0x80010100 (RPC_E_SYS_CALL_FAILED)). This is typically because the COM context 0xfc94b0 where this RuntimeCallableWrapper was created has been disconnected or it is busy doing something else. Releasing the interfaces from the current COM context (COM context 0xfc9568). This may cause corruption or data loss. To avoid this problem, please ensure that all COM contexts/apartments/threads stay alive and are available for context transition, until the application is completely done with the RuntimeCallableWrappers that represents COM components that live inside them.
Blockquote
The program is reading and analyzing about 200 large excel files, generating one output large excel file. So far I was using it on a smaller amount of files, so perhaps it has to do something with larger memory usage. On the other hand the machines I use have 16GB of RAM. While n run time it doesn't look like memory leak. I don't use pointers, or dynamic memory allocations - simply open files, read, write and close.
While I read I can disable the "'DisconnectedContext' " I prefer to understand how to locate the problem and fix it.
The problem occurs on two separated machines.
How can I debug it?
Where to start?
Thank you

Xcode: Determine caller of function in xcode in debug

How can I determine where some function called in debug state? I'm in stuck with EXC_I386_GPFLT error hence I do not expect invocation such function with my test case.
You can try new Xcode 7 feature called Address Sanitizer.
In Xcode go to Product -> Scheme -> Edit Scheme, select Run, open Diagnostics tab and check Enable Address Sanitizer.
Then Product -> Clean project and run it again.
Objective-C and C code is susceptible to memory corruption issues such
as stack and heap buffer overruns and use-after-free issues. When
these memory violations occur, your app can crash unpredictably or
display odd behavior. Memory corruption issues are difficult to track
down because the crashes and odd behavior are often hard to reproduce,
and the cause can be far from the origin of the problem.
You enable the address sanitizer in the build scheme. Once enabled,
added instrumentation is built into the app to catch memory violations
immediately, enabling you to inspect the problem right at the place
where it occurs. Other diagnostic information is provided as well,
such as the relationship between the faulty address and a valid object
on the heap and allocation/deallocation information, which helps you
pinpoint and fix the problem quickly. The address sanitizer is
efficient—fast enough to be used regularly as well as with interactive
applications. It is supported in OS X, in the Simulator, and on iOS
devices.
New features in Xcode 7

Is there a way to get "Dominator Tree"-like functionality from a running JVM?

Recently, I've been digging in to JVM heap dumps using Eclipse MAT. I like it, but the one feature that I seem to use the most is the Dominator Tree. Eclipse's example screenshot:
Anyways, I find that a lot of the time, I usually get the most value out of just looking at that table and getting the first few entries. Since the turnaround time for getting this is:
Create Heap Dump (jcmd <pid> GC.heap_dump)
Download/Pull heapdump to a location (MAT isn't installed on our servers)
Run Eclipse MAT's ParseHeapDump.sh tool to build the various trees
Open MAT, click Dominator Tree icon.
Analyze
Is there a way to get this equivalent information off of a running JVM programmatically? I'd like to run some kind of gather_dominators.sh <pid> script on a host and get the Top X Objects from a JVM, but I don't know where to start.
If by "running jvm" You meant - "getting the info without doing stop-world heap-dump" then the obvious answer is: in order to do such thing without "full-scan" - the data needs to be collected throughout system life-time by tapping creation/release of each object and by maintaining the statistics. You could achieve such things by instrumentation or by using a ready-made custom agents (jol/jamm/etc). Note that many GCs are already doing similar work to collect (and print) statistics. IIRC - newer JVMs even keep track of such info within the class-metadata area (so getting statistics is instant).
https://github.com/google/allocation-instrumenter
(google-allocation-instumenter)
http://blog.javabenchmark.org/2013/07/compute-java-object-memory-footprint-at.html (with JAMM)
https://github.com/jbellis/jamm (JAMM src)
In Java, what is the best way to determine the size of an object? (JOL/etc here)
http://www.javaworld.com/article/2074458/core-java/estimating-java-object-sizes-with-instrumentation.html (short DYI guide)
https://www.youtube.com/results?search_query=Understanding+Java+GC
(webCast on how GC traverses objects for similar purposes)
On other hand - if You're fine to grab a heap-dump (which should be fine on any production system with any proper node-redundancy in place, designed for handling unavoidable Sun-JVM stop-world GC pauses), then Jhat, MAT-api, YourKit and Jol are probably Your best friends:
Programmatically analyze java heap dump file
How to analyse the heap dump using jmap in java
It is important to note that currently-existing heap-dump format loses the info about actual sizes of objects, so all tools (MAT/etc) are just trying to GUESS it properly:
http://shipilev.net/blog/2014/heapdump-is-a-lie/ (What Heap Dumps Are Lying To You About, by Aleksey Shipilёv)
HTH :)

Flash Builder Profiler runs out of java heap space trying to expand paths to GCRoot

Using Flash Builder 4 on Mac OS X, trying to debug why it seems our Air app is leaking the objects declared in the MXML files, but if I try to expand the Instance in the Object Reference tab of the profiler, it runs for several minutes before throwing a java heap space error.
The heap is already set at -Xmx1024m, setting it to 2048m causes FB to not start at all.
It seems the trick is that you can have either the Allocation Stack or the Path to GCRoot.
Thank you Adobe for inventing the Heisenberg Uncertainty Profiler.

Measure heap memory used by individual objects

Just curious, Is there a way to measure the heap memory consumed by each individual object from inside the code in realtime?
(I know I can use VisualVM and Eclipse Memory Analyzer as answered here, but is there a way to do this from the inside?)
Since you don't want to you the free tools available, you can look into the Hprof (freely available)code, try to change it in your own way. Hprof internally uses JVMTI . It will work.