What is the purpose of 'Captures' tab in Android Studio 2.3.3? - android-studio

I had noted a new tab 'Captures' on the left side of the Android Studio 2.3.3.
For me it is seem to be empty.
What is Captures meant for?
Please refer the documentation explaining on Captures in Android Studio.

When you're monitoring memory usage in the Memory Monitor included in Android Monitor you can, at the same time, dump a snapshot of the Java heap to an Android-specific Heap/CPU Profiling (HPROF) file. The HPROF Viewer displays classes, instances of each class, and a reference tree to help you track memory usage and find memory leaks. HPROF is a binary heap dump format originally supported by J2SE.
After you do a heap dump, Android Studio automatically stores it so you can view it again. "Captures" is where you see these saved HPROF dumps.
You can also see captured view layout etc there as well.
There isn't an answer to this in the built-in help. However, according to the release notes from 2015, it is a "view which shows the various performance data files you've collected".
You can learn more about Captures in the documentation about HPROF.

Related

Can't increase heap size

I keep on trying to increase the heap size inside of android studio, but the memory remains the same, anyone know why? Thanks in advance !
Look at how the heap memory is stuck on 494M
Click on Help -> Edit Custom VM Options.... If you don't have any VM options created, it'll prompt you to create one, accept it. Add / modify -Xmx with amount and type of data you want, like -Xmx8g for 8gb of heap. You should restart Android Studio afterwards so it'll take effect.
Edit: For more information about studio options, take a look at here.
Edit 2: If you have a problem with jps, make sure you added up $PATH for java home. See more details on this answer.

How can you view the actual Bitmap on Android Studio 3.2?

I know there is a nice feature which you can view the actual Bitmap from heap dump prior to Android Studio 3, but seems gone.
Ref
https://stackoverflow.com/a/40945553/827785
Got an answer from Android Studio team's profiler lead:
The “view bitmap” feature is still there (for Android 5.0 to 7.1): in
heap dump, when you select a Bitmap (or related) class and then an
instance, you'll see an extra tab titled “Bitmap Preview” in the
instance details panel (next to the “References” tab). That has the
bitmap you want.
However, there's a caveat: At some time during the Oreo (Android 8.0)
timeframe, there was a change to Android's HPROF serialization to NOT
include the bitmap contents. The reason is technical: HPROF is a
snapshot of the Java heap, not the native heap, but bitmap contents
actually reside within the native heap. In essence, older Android
versions were breaking the spec in order to provide a convenience, and
this "loop hole" has since been closed.
It’s definitely on our to-do list to investigate ways to foreground
that information once again in Oreo and newer Android versions.
https://www.reddit.com/r/androiddev/comments/av3lhx/were_on_the_engineering_team_for_android_studio/ehhlfdt

Memory profiling on Visual studio 2012 PRF0025 error

I implemented big program to find nearest neighbor using kd-Tree. But when I test it, used memory is bigger and bigger. I tried this advice, bud still not working. (No data collected when profiling .NET class library with Visual Studio 2012)
output of profiler:
Profiling started.
Warning VSP2355: Some Windows counters will not be collected. Without this data, some performance rules may not fire.
Profiling process ID 10112 (KdTreeNN).
Process ID 10112 has exited.
Data written to C:\<path>\KdTreeNN\KdTreeNN140529.vsp.
Profiling finished.
PRF0025: No data was collected.
Profiling complete.
Some other advices? Please help. Thanks

How do I instrument a VSTO plugin (Excel) using the Visual Studio toolset?

I am trying to profile and instrument my VSTO Excel plug-in using Visual Studio 2012 on Windows 8. I would like to collect managed function call counts and their timings.
I have no problems with the default sampling option, but the results are generally too high level for me (i.e. ntdll.dll and wow64.dll are the binaries doing "all the work"). However, my attempts to instrument the plug-in always yield "no data" results; I've tried to attach to an existing Excel process, pause and switch the profiling method to "Instrumentation", as well as using the Performance Wizard to create an instrumented profile.
In this case, the output window shows messages like the following:
Data written to C:\project-source\Report130912(3).vsp.
Profiling finished.
File contains no data buffers
File contains no data buffers
Analysis failed
Is this scenario supported for Visual Studio, or have I done something wrong? Is there another tool I can try to obtain this data?
I figured this out by... making my search query more general :)
http://mikedoszhang.blogspot.com/2011/10/profile-net-office-add-in-through.html
In essence, each binary that requires instrumentation must be registered for COM interop and built for the x86 architecture (not Any CPU). Also, you need to explicitly specify the binaries that you want to instrument.

Debugging memory leaks in Windows Explorer extensions

Greetings all,
I'm the developer of a rather large C# Windows Explorer extension. As you can imagine, there is a lot of P/Invoke involved, and unfortunately, I've confirmed that it's leaking unmanaged memory somewhere. However, I'm coming up empty as to how to find the leak. I tried following this helpful guide, which says to use WinDBG. But, when I try to use !heap, it won't let me because I don't have the .PDB files for explorer.exe (and the public symbol files aren't sufficient, apparently).
Help?
I've used many time UMDH with very good results. The guide you mentioned describing WinDbg uses the same method as UMDH, based on ability of debug heap to record stack traces for all allocations. The only difference is that UMDH does it automated -- you simply run umdh from command line and it creates snapshot of all current allocations. Normally you to repeate the snapshots two or more times, then you calculate 'delta' between two snapshots (also using umdh.exe). The information on the 'delta' file gives you all new allocations that happen between your snapshots, sorted by the allocation size.
UMDH also needs symbols. You will need at least symbols for ntdll.dll (heap implementation lives there). Public symbols available on public symbols from http://msdl.microsoft.com/download/symbols will work fine.
Make sure you are using correct bitness of the umdh.exe. Explorer.exe is 64 bit on 64 bit OS, so if your OS is 64 bit you need to use 64 bit umdh.exe -- i.e. download appropriate bitness of Windows debugging tools.

Resources