This project has moved. For the latest updates, please go here.

Can I use PTVS to detect memory leaks?

Jul 11, 2014 at 11: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.
Jul 11, 2014 at 11: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, 2014 at 6: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

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

h.heap() Unable to evaluate the expression.

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

import objgraph
error: [Errno 10054] An existing connection was forcibly closed by the remote host