new to dotMemory
Hi,
I'm new to memory profiling tools & to the large code base at a new job... I was given a PerfMon dump where the “Promoted Memory from Gen 0″ is suspected of being too large.
The only avenue I have into the code is via an NUnit test, & the test uses a large number of dll's where the objects might be held on to for too long.
How do I use dotMemory to show the memory usage inside the dll's?
Thanks!
- O8
Please sign in to leave a comment.
Hi,
I'm not sure I understand you correctly, but I'll try to help you.
If you have a .net application run it uder profiling using dotMemory and get snapshot at any moment you want. This memory snapshot will contain all objects held in memory on the moment of getting. You are able to investigate these objects in a number of ways. E.g. group all objects by assembly of declarations
https://www.jetbrains.com/dotmemory/help/Analyzing_Results.html
If you do not have an application but rather have an unit tests only, as entry point, you can use dotMemory Unit to analyze memory data or just to get memory snapshots.
You can read more about this approach here
http://blog.jetbrains.com/dotnet/2015/03/04/unit-testing-and-memory-profiling-can-they-be-combined/
ask me if have any questions
Heya,
Well, I already ran into a different issue. My office already had 8.1, but when I followed the instructions on http://blog.jetbrains.com/dotnet/2015/04/09/updating-from-previous-versions-of-resharper-to-9-1-from-within-visual-studio/#comment-430480,there was no Update option. After it installed, it looks like I have the 9.1 eval version. I tried using the license username+key combo I was given, but the Manage License Keys dialogue says “License to version 8.0 not acceptable”.
Am I able to upgrade from 8.1 to 9.1?
Thanks!
- O8
UPDATE : got a response on this from the blog page mentioned... I'll get back to the main issue @ hand...
Hi,
I followed the instructions in the dotMemory Unit, but was unable to take snapshots. Basically, I'd like to be able to see some results that are similar, in some way, to the PerfMon stats I was given. I'm imagining I'd like to see counts/lists of objects that were promoted in any of the code engaged by starting the test. Is that possible?
Thanks!
- O8
UPDATE : let me be clear about what I've done...
* installed resharper 9.1.1
* installed dotMemory Unit from NuGet
* add the using stmt to the cs file where the test lives
* clicked the icon in the gutter to run the test under dotMemory Unit, which opened a new Unit Test Sessions window
* the new window doesn't have anything on it similar to the Analysis Overview link you provided (I did notice, however, that example image on that page shows a window for dotMemory, not Unit Test Sessions)
dotMemoryApi.SaveCollectedData() saves all memory snapshots taken during the test as a dotMemory workspace, which can be opened and investigated in standalone dotMemory.
Try somethig like that
[Test]
void SomeTest()
{
dotMemoryApi.GetSnapshot();
// some custom code
dotMemoryApi.GetSnapshot();
}
Where does that workspace get saved so I can open it w/ dotMemory?
Do I need to run the unit test under dotMemory Unit?
UPDATE : to answer the 2nd question for myself, the Unit Test Sessions window indicated the dotMemory calls were ignored, so I ran the test again under dotMemory Unit. New question:
* every time I've tried to use dotMemory calls inside the test, the Unit Test Sessions window shows the test as running, but I've never seen it finish - usually due to my impatience after 10 minutes of waiting, when running the test w/o the calls finishes in about 5 seconds. How many times longer will the test take w/ the calls in it?
You can pass a directory where to save a workspace to SaveCollectedData method. If you don't provide any it will save it in the %Temp% folder. But in any case dotMemory Unit shows a path to the saved workspace in the test output.
Tests run slower under profling but not so slow, it looks like a bug.
What version of R# and what version of dotMemory Unit do you use?
below is from the resharper about window. & attached is a screenshot of the list of nuget pkgs for the sln.
JetBrains ReSharper Ultimate 2015.1.1 Build 102.0.20150521.123255
dotMemory 4.3.20150521.131505
dotTrace 6.1.20150521.132011
dotCover 3.1.20150521.131501
ReSharper 9.1.20150521.134223
Custom Gallery:
Application Packages:
JetBrains DotCommon Core build 102.0.20150521.123918 on 2015-05-21 12:39:18Z.
JetBrains DotCommon ElevationAgent build 102.0.20150521.123918 on 2015-05-21 12:39:18Z.
JetBrains DotCommon.Psi Navigation build 102.0.20150521.130907 on 2015-05-21 13:09:08Z.
JetBrains DotCommon.Psi UnitTesting build 102.0.20150521.130907 on 2015-05-21 13:09:08Z.
JetBrains DotCommon Remotable build 102.0.20150521.123918 on 2015-05-21 12:39:18Z.
JetBrains DotCommon Timeline build 102.0.20150521.123918 on 2015-05-21 12:39:18Z.
JetBrains DotCover Core build 102.0.20150521.131501 on 2015-05-21 13:15:02Z.
JetBrains DotCover Presentation build 102.0.20150521.131501 on 2015-05-21 13:15:02Z.
JetBrains DotCover VisualStudio build 102.0.20150521.131501 on 2015-05-21 13:15:02Z.
JetBrains DotMemory Common build 102.0.20150521.131505 on 2015-05-21 13:15:06Z.
JetBrains DotMemory VisualStudio build 102.0.20150521.131505 on 2015-05-21 13:15:06Z.
JetBrains DotTrace Core build 102.0.20150521.132011 on 2015-05-21 13:20:13Z.
JetBrains DotTrace VisualStudio build 102.0.20150521.132011 on 2015-05-21 13:20:13Z.
JetBrains EtwService Core build 102.0.20150521.123857 on 2015-05-21 12:38:58Z.
JetBrains EtwService msi build 102.0.20150521.123235 on 2015-05-21 12:32:35Z.
JetBrains EtwService Native Core build 102.0.20150521.123235 on 2015-05-21 12:32:35Z.
JetBrains Fake VisualStudio VsPackageAssembly build 11.0.0.0 on 2015-07-15 20:16:27Z.
JetBrains Platform Core Ide build 102.0.20150521.123255 on 2015-05-21 12:32:55Z.
JetBrains Platform Core Shell build 102.0.20150521.122743 on 2015-05-21 12:27:43Z.
JetBrains Platform Core Text build 102.0.20150521.123255 on 2015-05-21 12:32:55Z.
JetBrains Platform Installer build 102.0.20150521.123255 on 2015-05-21 12:32:55Z.
JetBrains Platform Interop dotMemoryUnit.Interop build 102.0.20150521.123255 on 2015-05-21 12:32:55Z.
JetBrains Platform Standalone Shell build 102.0.20150521.123255 on 2015-05-21 12:32:55Z.
JetBrains Platform Symbols build 102.0.20150521.123255 on 2015-05-21 12:32:55Z.
JetBrains Platform VisualStudio build 102.0.20150521.123255 on 2015-05-21 12:32:55Z.
JetBrains Profiler Configurator Core build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Configurator WPF build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Editor Core build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Editor Windows BehaviorModel build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Editor Windows WPF build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler History Core build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Kernel CleanUp build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Kernel Core build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Kernel InternalLauncher build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Kernel Windows Api build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Kernel Windows Engine build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler Kernel Windows Native Core build 102.0.20150521.123240 on 2015-05-21 12:32:40Z.
JetBrains Profiler Snapshot build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler VsIntegration Core build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Profiler VsIntegration Windows build 102.0.20150521.124414 on 2015-05-21 12:44:14Z.
JetBrains Psi.Features SolutionBuilder build 102.0.20150521.124132 on 2015-05-21 12:41:33Z.
JetBrains Psi.Features src build 102.0.20150521.124132 on 2015-05-21 12:41:33Z.
JetBrains Psi.Features Tasks build 102.0.20150521.124132 on 2015-05-21 12:41:33Z.
JetBrains Psi.Features VisualStudio build 102.0.20150521.124132 on 2015-05-21 12:41:33Z.
JetBrains ReSharper src build 102.0.20150521.134223 on 2015-05-21 13:42:24Z.
dotCover 3.1.1 Free trial period is running. 29 days left
ReSharper 9.1.1 Free trial period is running. 29 days left
Visual Studio 11.0.61030.0.
Copyright © 2015 JetBrains. All rights reserved.
Attachment(s):
dotmemoryunit.png
Please, try to get release (not EAP) version of dotMemory Unit (1.0.20150408.170258).
We broke a bit compatibility in the EAP version. Will fix it soon.
ok - what's the nuget console command to get that particular version?
Install-Package JetBrains.DotMemoryUnit -Version 1.0.20150408.170258
https://www.nuget.org/packages/JetBrains.DotMemoryUnit/
after installing the DotMemory Unit version you specified, adding the using stmt, & putting the calls inside the test method around everything else, I get the following exception (the bolded portion is the test method where the calls were added):
System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.
----> JetBrains.Profiler.Windows.Api.ProfilingApiException : Unrecoverable error
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at JetBrains.dotMemoryUnit.Client.ReflectionExtension.Invoke(Object instance, MethodBase method, Object[] args)
at JetBrains.dotMemoryUnit.Client.DotMemoryUnitProxy.GetSnapshot()
at JetBrains.dotMemoryUnit.Kernel.dotMemoryApi.GetSnapshot()
at Partners.Cvs.Test.Integration.TestIntegration.UpdatePatientsAndClaims() in TestIntegration.cs: line 1547
--ProfilingApiException
at JetBrains.Profiler.Windows.Api.Impl.Helper.CheckHResult(HResults hr)
at JetBrains.Profiler.Windows.Api.MemoryProfiler.Dump()
at JetBrains.dotMemoryUnit.ClientController.DotMemoryUnitClient.<GetSnapshot>b__0()
at JetBrains.dotMemoryUnit.ClientController.Transport.WcfExceptionTransport.CallRemoteLogic<T>(Func`1 remoteLogic)
at JetBrains.dotMemoryUnit.ClientController.DotMemoryUnitClient.ExecuteLogic<T>(Func`1 action)
at JetBrains.dotMemoryUnit.ClientController.DotMemoryUnitClient.GetSnapshot()
am I missing something?
ouch!
Could you please remove nuget reference from project, close Visual Studio, delete unpacked dotMemory Unit nuget from "packages" folder in your solution folder, start Visual Studio and add reference to dotMemory Unit afresh?
Make a simple test
[Test]
void Test()
{
dotMemoryApi.GetSnapshot();
dotMemoryApi.SaveCollectedData();
}
run it alone under dotMemory Unit.
tell me about result
UPDATE:
also delete mentions of dotMemory Unit from package.config file (if you still have it after uninstaling dotMemory Unit)