Can I programmatically create a memory snapshot on a PC without Visual studio?

Josh Hart 21 Reputation points
2021-04-20T23:57:33.07+00:00

The profiling tool is very useful at debugging memory leaks using the memory snapshot feature.
However if there is a memory leak that is happening on a client/customers PC that we do not know how to reproduce then we can not figure out what is wrong.

Is there a way to programmatically generate a memory snapshot file that the customer can then send us so that we can load it into the profiling tool to analyse the memory usage and where the memory leaks could be happening?

My application uses a mixture of managed and unmanaged memory however I am fairly certain that the problem lies in the unmanaged code

Developer technologies | Visual Studio | Debugging
{count} votes

1 answer

Sort by: Most helpful
  1. Dylan Zhu-MSFT 6,426 Reputation points
    2021-04-21T03:19:17.797+00:00

    Hi JoshHart,

    Maybe you can refer to Profiler API, you need to call and use it in your project and it will output the collected data into a .vsp file.

    By the way, according to your requirement, we suggest you could use VSDiagnostics.exe tool to collect the data. The tool locates at C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Team Tools\DiagnosticsHub\Collector, and you can write a script (exe or other)for it, then you can package the script and the tool with dependencies , then move it to other machine which doesn't have visual studio.

    Best Regards,
    Dylan


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our **documentation to enable e-mail notifications if you want to receive the related email notification for this thread.**


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.