<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:v =
"urn:schemas-microsoft-com:vml" xmlns:o =
"urn:schemas-microsoft-com:office:office" xmlns:w =
"urn:schemas-microsoft-com:office:word" xmlns:m =
"http://schemas.microsoft.com/office/2004/12/omml"><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2900.2963" name=GENERATOR>
<STYLE>@font-face {
        font-family: Cambria Math;
}
@font-face {
        font-family: Calibri;
}
@font-face {
        font-family: Segoe UI;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.0in 1.0in 1.0in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; mso-style-builtin: yes
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; mso-style-builtin: yes
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; FONT-FAMILY: "Times New Roman","serif"; mso-style-builtin: yes
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-builtin: yes; mso-style-priority: 99
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline; mso-style-builtin: yes; mso-style-priority: 99
}
A:visited {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-builtin: yes; mso-style-priority: 99
}
SPAN.MsoHyperlinkFollowed {
        COLOR: purple; TEXT-DECORATION: underline; mso-style-builtin: yes; mso-style-priority: 99
}
SPAN.EmailStyle17 {
        COLOR: #1f497d; FONT-FAMILY: "Calibri","sans-serif"; mso-style-type: personal-reply
}
.MsoChpDefault {
        FONT-SIZE: 10pt; mso-style-type: export-only
}
DIV.Section1 {
        page: Section1
}
</STYLE>
<!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></HEAD>
<BODY lang=EN-US vLink=purple link=blue bgColor=white>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Inside the while cycle, i just
do this:</FONT></DIV>
<DIV><FONT face=Arial size=2>
<P><FONT size=3><FONT color=#006400> pyEngine.</FONT><B><FONT
color=#191970>RunFile</B></FONT></FONT><FONT size=3><FONT
color=#006400>("scripts/CMOpAtiendeCM.py"</FONT><FONT
color=#006400>);</P></FONT></FONT></FONT></DIV>
<DIV><FONT face=Arial size=2> thats the little script file.
The engine is created only once.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> However, i did inside the
cycle a Console.WriteLine("{0} bytes", System.GC.GetTotalMemory(true)) and
it gives lower memory usage, there i see that IP seems to be consuming each time
the file is run only 2k, no 2m, as the windows taskmanager
says</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> I do use events, but i do remove
the handlers when no longer in use...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Where can i get a free CLR
profiler ?? :)...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> thanks for the
help...</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> Greetings....</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=dinov@exchange.microsoft.com
href="mailto:dinov@exchange.microsoft.com">Dino Viehland</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A title=users@lists.ironpython.com
href="mailto:users@lists.ironpython.com">Discussion of IronPython</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Friday, August 11, 2006 1:48
PM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [IronPython] Embedded IP
eating memory</DIV>
<DIV><BR></DIV>
<DIV class=Section1>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">How
are you executing the script file? If you’re creating a new optimized
module each time we won’t be able to collection the optimized module
code. If on the other hand you’re just compiling it as a helper method
then when it’s done running we can collect the code.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">In
pre-RC1 we had a leak where creating a new PythonEngine would result in a leak
of a SystemState and ClrModule which were being hung onto by an event rooted
in the app domain. So if you’re re-creating the engine each time you
might be seeing that. Also, now that I’ve mentioned events, you might
want to check your own C# code if you’re using events: It’s easy to
forget to unhook one and leak memory because the event handler stays alive
forever.<o:p></o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'">If
none of those turn out to be the problem an option here would be to download
the free CLR Profiler and look at the object type that is consuming the
increased memory. It’ll give you a nice graphical display w/ a block
view of what’s referencing what. <o:p></o:p></SPAN></P>
<P class=MsoNormal><o:p> </o:p></P>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 11pt; COLOR: #1f497d; FONT-FAMILY: 'Calibri','sans-serif'"><o:p> </o:p></SPAN></P>
<DIV>
<DIV
style="BORDER-RIGHT: medium none; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; PADDING-LEFT: 0in; PADDING-BOTTOM: 0in; BORDER-LEFT: medium none; PADDING-TOP: 3pt; BORDER-BOTTOM: medium none">
<P class=MsoNormal><B><SPAN
style="FONT-SIZE: 9pt; FONT-FAMILY: 'Segoe UI','sans-serif'">From:</SPAN></B><SPAN
style="FONT-SIZE: 9pt; FONT-FAMILY: 'Segoe UI','sans-serif'">
users-bounces@lists.ironpython.com [mailto:users-bounces@lists.ironpython.com]
<B>On Behalf Of </B>Rodolfo Conde<BR><B>Sent:</B> Friday, August 11, 2006
12:58 PM<BR><B>To:</B> Discussion of IronPython<BR><B>Subject:</B>
[IronPython] Embedded IP eating memory<o:p></o:p></SPAN></P></DIV></DIV>
<P class=MsoNormal><o:p> </o:p></P>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
Hi....</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
I have an IP-Embedded C# application (IP version IronPython 1.0.60523
(Beta) on .NET 2.0.50727.42, Yeah i know, im out of date, but i havent make
the change to latest version because i saw there were some API changes :)
), i create one PyEngine, set some global variables and inside a while
block i execute this little script every
time:</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">import
sys</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">try:<BR> i =
sys.path.index("scripts")<BR>except:<BR> sys.path.append("scripts")</SPAN><o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal> <o:p></o:p></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR>import
CMOpFuncionalidad<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"><BR>try:<BR> pyop
= CMOpFuncionalidad.PyOperador(cmop, dba,
connID)<BR> pyop.atiendeCM()<BR> pyop.liberaRecursosBD()<BR> pyop
= None<BR>except:<BR> pyop.liberaRecursosBD()<BR> pyop =
None<BR> raise<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">The module
CMOpFuncionaliad is an IPython script i wrote, it contains a class definition.
Inside the scripts i use components defined in some assemblies i made (these
are already loaded into the CLR). The problem is, after the Engine takes
the usual 12M+- of memory it needs, every time the script executes it consumes
2M more, i dont have a clue why is this...Does this version of IP have memory
problems ? Or what else could be ?? If you need to see CMOpFuncionalidad.py
let me know and ill send it....<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
Thanks for your help....<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'">
Greetings...<o:p></o:p></SPAN></P></DIV>
<DIV>
<P class=MsoNormal><SPAN
style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"> <o:p></o:p></SPAN></P></DIV></DIV><BR><BR>__________
Información de NOD32, revisión 1.1703 (20060811) __________<BR><BR>Este
mensaje ha sido analizado con NOD32 antivirus system<BR><A
href="http://www.nod32.com">http://www.nod32.com</A><BR>
<P>
<HR>
<P></P>_______________________________________________<BR>users mailing
list<BR>users@lists.ironpython.com<BR>http://lists.ironpython.com/listinfo.cgi/users-ironpython.com<BR><BR><BR>__________
Información de NOD32, revisión 1.1703 (20060811) __________<BR><BR>Este
mensaje ha sido analizado con NOD32 antivirus
system<BR>http://www.nod32.com<BR><BR></BLOCKQUOTE></BODY></HTML>