What are the challenges you face when working across database platforms? Take the survey

Stop Profiling, then continue? + some general questions


I'm new here, and just downloaded ANTS Memory Profiler, just trying out the trial period to see if I can get into it. I found the built VS2017 one very confusing to use.

I'm just profiling my application and I clicked "Stop Profiling", it then closed the application down - which was a pain as I wanted to carry on profiling some other areas of the app, and because it closed down - it's not cleaned up my database "Login" sessions for the app. :( is there a way to "Pause" profiling ??? or do I just let it keep running and take more snapshots later on -

Can I delete older snapshots - in VS2017 I found I was getting errors due to not enough room to make snapshots after about 4 shots with my current application, so had to delete the older ones.

I've noticed that the profiler runs the application - so I don't run it from VS2017 - so how can I view my C# code of where the issues might be?




  • Options
    There is not a way to pause profiling, yet. It's coming. You leave the profiler running and then can take a snapshot periodically either manually or programmatically.

    Snapshots are stored in C:\Users\<username>\AppData\Local\Red Gate\ANTS Memory Profiler 8\Results\, and if you don't save the results they will be automatically deleted. You can't delete them whilst AMP is running as they'll be in use and locked.

    I'm not really sure quite what you mean by the final question. You have access to your code in Visual Studio so can view it there? The profiler will show you areas of your code that cause issues. You then need to know your code to work on them.
    Have you visited our Help Centre?
  • Options
    HaragHarag Posts: 8 New member
    Hi Russel,

    Many thanks for the quick response, much appreciated.

    As for the VS/Viewing Code - what I did with the built in diagnostics is run the application with break points in it, then I could take snap shots run a but more and take another snapshot - all within the same winform - VS diagnostics is fairly new to me, so maybe I was just doing it wrong, but I did find a few memory leaks this way. Guess I'll just have to keep playing around with it - installed the VS Extension so will try that too.
  • Options
    Russell DRussell D Posts: 1,324 Diamond 5
    edited February 9, 2018 3:09PM
    Ah I see - yes that is a nicer workflow I agree, but performance issues I am sure would arise from putting the profiler into VS, and would probably make it a lot worse than worth it!

    The VS extension just launches the profiler for you I'm afraid - which is more convenient, but not exactly what you're after above.
    Have you visited our Help Centre?
  • Options
    HaragHarag Posts: 8 New member
    Thanks for the reply Russel, I can see why it's not run in VS. Apologies for the questions, couple more:

    1. Earlier you said " or programmatically." - How can I take a snapshot programmatically ?
    2. When I run the profiler from VS (or manually) should I compile my VS code in DEBUG or RELEASE mode?
  • Options
    You can use the snapshot API to achieve this automatically: https://documentation.red-gate.com/amp8/working-with-profiling-results/using-the-snapshot-api.

    I'd get it as close to the finished product as possible, so release.
    Have you visited our Help Centre?
  • Options
    HaragHarag Posts: 8 New member
    Hi, thanks for the link - I'm just working my way through that document and not got to that point yet. :)

    Sorry another quick question. I'm opening a child form like so:

    using (var form = new FormOptions())

    and when I close the above "options" form down and return to my main app, I then do a snapshot. I've noticed some objects still in the memory (form wide private variable), but if I take another snapshot it removes those object (I believe it's something to do with a finalize queue. so In a sense I have to take two snapshots to make sure these are removed. How can I just take the one snapshot and filter out all those that will be cleared on the next snapshot (GC.Collect?). In the filters at the bottom I'm currently setting the filter to only show NEW items between the two snapshots.


Sign In or Register to comment.