<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";
        color:black;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body bgcolor="white" lang="EN-US" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I recently wrote a script that dumps an IronPython 2.6.1 (.NET 2.0) object.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Probably won't work on anything else.</span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"> </span></p><div><div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in"><p class="MsoNormal">
<b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext"> <a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a> [mailto:<a href="mailto:users-bounces@lists.ironpython.com">users-bounces@lists.ironpython.com</a>] <b>On Behalf Of </b>Lukas Cenovsky<br>
<b>Sent:</b> Monday, October 18, 2010 8:27 PM<br><b>To:</b> Discussion of IronPython<br><b>Subject:</b> Re: [IronPython] gcroot for ironpython object</span></p></div></div><p class="MsoNormal"> </p><p class="MsoNormal">Thanks - that works. I've also found Kamil's blog post:<br>
<a href="http://blog.kamil.dworakowski.name/2008/02/debugging-memory-problems-in-ironpython.html">http://blog.kamil.dworakowski.name/2008/02/debugging-memory-problems-in-ironpython.html</a><br><br>Now I'm fighting with <Unloaded Type>s - trying to convert them to something readable...<br>
Kamil's script does not seem to work - I don't see any dict holding the ironpython object in the stacktrace: <br><br><tt><span style="font-size:10.0pt">...</span></tt><span style="font-size:10.0pt;font-family:"Courier New""><br>
<tt> 0330d0f4(System.Windows.Controls.StackPanel)-></tt><br><tt> 0330d22c(System.Windows.Controls.UIElementCollection)-></tt><br><tt> 0330d240(System.Windows.Media.VisualCollection)-></tt><br><tt> 0330d520(System.Object[])-></tt><br>
<tt> 0330d428(System.Windows.Controls.Button)-></tt><br><tt> 0824cb0c(System.Windows.EffectiveValueEntry[])-></tt><br><tt> 0824cb00(System.Windows.EventHandlersStore)-></tt><br><tt> 0824cc00(MS.Utility.SingleObjectMap)-></tt><br>
<tt> 0824cbe0(MS.Utility.FrugalObjectList`1[[System.Windows.RoutedEventHandlerInfo, PresentationCore]])-></tt><br><tt> 0824cbec(MS.Utility.SingleItemList`1[[System.Windows.RoutedEventHandlerInfo, PresentationCore]])-></tt><br>
<tt> 0824caa8(System.Windows.RoutedEventHandler)-></tt><br><tt> 0824ca44(System.Object[])-></tt><br><tt><b> 0824ca18(IronPython.Runtime.Method)-></b></tt><b><br><tt> 08162f84(<Unloaded Type>)-></tt></b><br>
<tt> 08163d78(IronPython.Runtime.PythonDictionary)-></tt><br><tt> 08163d6c(IronPython.Runtime.StringDictionaryStorage)-></tt><br><tt> 08163d84(System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.Object, mscorlib]])-></tt><br>
<tt> 081c5558(System.Collections.Generic.Dictionary`2+Entry[[System.String, mscorlib],[System.Object, mscorlib]][])-></tt><br><tt> 0816b3bc(System.GopherStyleUriParser)</tt></span><br><br>--<br>-- Lukáš<br><br><br>On 18.10.2010 20:04, Jonathan Allen wrote: </p>
<pre>One trick is to give it a radioactive marker like they do in medical shows. </pre><pre> </pre><pre>Have that instance you care about reference an instance of EmailMessage or some other class you aren't actually using. Finding the EmailMessage object should be easy because there is only one, and from there you can find the IronPython object you are after.</pre>
<pre> </pre><pre>I use RedGate instead of WinDbg, so I'm not sure this will work for you. If you try it, please let me know the results.</pre><pre> </pre><pre>Jonathan</pre><pre> </pre><pre> </pre><pre>-----Original Message-----</pre>
<pre>From: Lukas Cenovsky <a href="mailto:cenovsky@bakalari.cz"><cenovsky@bakalari.cz></a></pre><pre>Sent: Monday, October 18, 2010 10:01 AM</pre><pre>To: Discussion of IronPython <a href="mailto:users@lists.ironpython.com"><users@lists.ironpython.com></a></pre>
<pre>Subject: [IronPython] gcroot for ironpython object</pre><pre> </pre><pre> Hi all,</pre><pre>I have an instance of IronPython object and I'd like to find out why it </pre><pre>is kept in memory (I use weakref to check it is still in the memory).</pre>
<pre> </pre><pre>What is the best way to find the object in WinDbg so I can call gcroot </pre><pre>for it? Or is there a better way to find out why my object is kept in </pre><pre>memory?</pre><pre> </pre><pre>Thanks.</pre>
<pre> </pre><pre>--</pre><pre>-- Lukáš</pre><pre> </pre><pre>_______________________________________________</pre><pre>Users mailing list</pre><pre><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a></pre>
<pre><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a></pre><pre> </pre><pre>_______________________________________________</pre><pre>
Users mailing list</pre><pre><a href="mailto:Users@lists.ironpython.com">Users@lists.ironpython.com</a></pre><pre><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a></pre>
<pre> </pre><pre> </pre><p class="MsoNormal"> </p></div></body></html>