Can I use PTVS to detect memory leaks?

Jul 11 at 10:22 PM
Can I use PTVS to detect memory leaks? I have a Python embedded into CLR, but Python side leaks memory. Can I use PTVS to detect the source of this leak? Python loads some sympy and numpy functions.
Coordinator
Jul 11 at 10:28 PM
We don't have any special tooling for this. But since it's just regular CPython, even if it's hosted in an app, it should be able to use the usual Python tools, like objgraph.
Jul 15 at 5:09 PM
I'm using guppy since it is much simpler to use. Analyzing object graphs looks more tedious approach.

I attached to embedded Python code (just Python language selected) and once any of my breakpoints hit, I opened the "python debug interactive" window. it works fine until I try to inspect the heap where everything stalls:

from guppy import hpy
h=hpy()
h.heap()

The same issue in the watch window which complains for last line:

h.heap() Unable to evaluate the expression.




Jul 17 at 12:45 PM
Similar, if I do in Immediate Window to attached embedded Python code:

import objgraph
objgraph.show_growth(limit=5)
error: [Errno 10054] An existing connection was forcibly closed by the remote host