[IronPython] gcroot for ironpython object

Idan Zaltzberg idan at cloudshare.com
Mon Oct 18 20:48:12 CEST 2010


I recently wrote a script that dumps an IronPython 2.6.1 (.NET 2.0) object.

Probably won't work on anything else.





*From:* users-bounces at lists.ironpython.com [mailto:
users-bounces at lists.ironpython.com] *On Behalf Of *Lukas Cenovsky
*Sent:* Monday, October 18, 2010 8:27 PM
*To:* Discussion of IronPython
*Subject:* Re: [IronPython] gcroot for ironpython object



Thanks - that works. I've also found Kamil's blog post:
http://blog.kamil.dworakowski.name/2008/02/debugging-memory-problems-in-ironpython.html

Now I'm fighting with <Unloaded Type>s - trying to convert them to something
readable...
Kamil's script does not seem to work - I don't see any dict holding the
ironpython object in the stacktrace:

...
  0330d0f4(System.Windows.Controls.StackPanel)->
  0330d22c(System.Windows.Controls.UIElementCollection)->
  0330d240(System.Windows.Media.VisualCollection)->
  0330d520(System.Object[])->
  0330d428(System.Windows.Controls.Button)->
  0824cb0c(System.Windows.EffectiveValueEntry[])->
  0824cb00(System.Windows.EventHandlersStore)->
  0824cc00(MS.Utility.SingleObjectMap)->

0824cbe0(MS.Utility.FrugalObjectList`1[[System.Windows.RoutedEventHandlerInfo,
PresentationCore]])->

0824cbec(MS.Utility.SingleItemList`1[[System.Windows.RoutedEventHandlerInfo,
PresentationCore]])->
  0824caa8(System.Windows.RoutedEventHandler)->
  0824ca44(System.Object[])->
*  0824ca18(IronPython.Runtime.Method)->**
  08162f84(<Unloaded Type>)->*
  08163d78(IronPython.Runtime.PythonDictionary)->
  08163d6c(IronPython.Runtime.StringDictionaryStorage)->
  08163d84(System.Collections.Generic.Dictionary`2[[System.String,
mscorlib],[System.Object, mscorlib]])->
  081c5558(System.Collections.Generic.Dictionary`2+Entry[[System.String,
mscorlib],[System.Object, mscorlib]][])->
  0816b3bc(System.GopherStyleUriParser)

--
-- Lukáš


On 18.10.2010 20:04, Jonathan Allen wrote:

One trick is to give it a radioactive marker like they do in medical shows.



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.



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.



Jonathan





-----Original Message-----

From: Lukas Cenovsky <cenovsky at bakalari.cz> <cenovsky at bakalari.cz>

Sent: Monday, October 18, 2010 10:01 AM

To: Discussion of IronPython <users at lists.ironpython.com>
<users at lists.ironpython.com>

Subject: [IronPython] gcroot for ironpython object



  Hi all,

I have an instance of IronPython object and I'd like to find out why it

is kept in memory (I use weakref to check it is still in the memory).



What is the best way to find the object in WinDbg so I can call gcroot

for it? Or is there a better way to find out why my object is kept in

memory?



Thanks.



--

-- Lukáš



_______________________________________________

Users mailing list

Users at lists.ironpython.com

http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



_______________________________________________

Users mailing list

Users at lists.ironpython.com

http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20101018/babd503d/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: py_obj.wds
Type: application/octet-stream
Size: 1061 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20101018/babd503d/attachment.obj>


More information about the Ironpython-users mailing list