Hi,

I'm currently trying to analyze the memory leak 
http://ironpython.codeplex.com/workitem/31764

One thing I found out so far is that sys.settrace (which is called by 
Python.SetTrace internally) seems to call pyContext.PushTracebackHandler 
without ever pulling that handler. 

I did insert some debug output, and it really seems that we're leaking one 
PythonTracebackListener instance (which internally references the 
PythonContext) on the thread static _tracebackListeners stack, which keeps all 
PythonContext instances which ever set a trace alive forever.

However, it seems this is not the only place where the PythonContexts are kept 
alive, because I tried to replace the Reference within the 
PythonTracebackListener with a Weak Reference, and the memory still leaked.

But when just not enabling ScriptTracing, the memory leak is reduced 
drastically, so I'm sure I'm on the right way to uncover at least one of the 
culprits.


PS:
One annoying thing is that "ClrProfiler" throws Exceptions when trying to get 
the memory dumps:

System.NullReferenceException: Der Objektverweis wurde nicht auf eine 
Objektinstanz festgelegt.
   bei CLRProfiler.LiveObjectTable.InsertObject(UInt64 id, Int32 
typeSizeStacktraceIndex, Int32 allocTickIndex, Int32 nowTickIndex, Boolean 
newAlloc, SampleObjectTable sampleObjectTable) in 
C:\CLRProfilerHelper\CLRProfiler\Sources\CLRProfiler\ReadNewLog.cs:Zeile 1030.
   bei CLRProfiler.ReadNewLog.ReadFile(Int64 startFileOffset, Int64 
endFileOffset, ReadLogResult readLogResult, Int32 requestedIndex) in 
C:\CLRProfilerHelper\CLRProfiler\Sources\CLRProfiler\ReadNewLog.cs:Zeile 2440.
   bei CLRProfiler.MainForm.showHeapButton_Click(Object sender, EventArgs e) in 
C:\CLRProfilerHelper\CLRProfiler\Sources\CLRProfiler\MainForm.cs:Zeile 2874.

Do you know of any other good and free (as in beer) tool for memory debugging?



Best regards

Markus Schaber
-- 
___________________________
We software Automation.

3S-Smart Software Solutions GmbH
Markus Schaber | Developer
Memminger Str. 151 | 87439 Kempten | Germany | Tel. +49-831-54031-0 | Fax 
+49-831-54031-50

Email: m.scha...@3s-software.com | Web: http://www.3s-software.com 
CoDeSys internet forum: http://forum.3s-software.com
Download CoDeSys sample projects: 
http://www.3s-software.com/index.shtml?sample_projects

Managing Directors: Dipl.Inf. Dieter Hess, Dipl.Inf. Manfred Werner | Trade 
register: Kempten HRB 6186 | Tax ID No.: DE 167014915 

_______________________________________________
Ironpython-users mailing list
Ironpython-users@python.org
http://mail.python.org/mailman/listinfo/ironpython-users

Reply via email to