<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml"><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY>
<DIV> </DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV></DIV>
<DIV class=OutlookMessageHeader lang=fr dir=ltr align=left><FONT face=Tahoma
size=2>-----Message d'origine-----<BR><B>De :</B> Mattias Gaertner
[mailto:nc-gaertnma@netcologne.de] <BR><B>Envoyé :</B> lundi 15 août 2011
19:09<BR><B>À :</B> Lazarus mailing list<BR><B>Objet :</B> Re:
[Lazarus] RE : RE : RE : RE : RE : RE : RE : Console App
Development<BR><BR></FONT></DIV>
<DIV style="MARGIN: 5px 0px"><BR>Martin <lazarus@mfriebe.de> hat am 15.
August 2011 um 17:27 geschrieben: <BR><BR>>[...] <BR>> > In the mean
time I found where the refcount increases: <BR>> > DoOpenUnknownFile
<BR>> > ->CodeToolBoss.GetSourceType <BR>> >
->FCurCodeTool.GetSourceName <BR>> >
->TPascalReaderTool.BuildTree<- this where the refcount increases to 2
</DIV>
<P style="MARGIN: 0px"> </P>
<P style="MARGIN: 0px">Correct. One for the scanner that scans the compiler
directives and extracts the "cleaned source" and one for the parser that reads
the pascal. </P>
<P style="MARGIN: 0px">Additionally the codetools caches the file sources
(i.e. the files converted to UTF-8). </P>
<P style="MARGIN: 0px">The biggest part of the files are kept in cache and
closing the project does not free this cache. </P>
<P style="MARGIN: 0px">For example once the codetools have loaded and parsed
the classes.pp it is kept in memory. </P>
<P style="MARGIN: 0px">This was so from the beginning (at least since 9
years). </P>
<P style="MARGIN: 0px">Of course the RTL and FCL sources grew over the years
and so the codetools need more memory.</P>
<P> </P>
<P>The other big caches of the codetools are the code nodes. The memory need
varies greatly depending on the code, but they typically need somewhat less
than the sources.</P>
<P>There is a lot of other stuff, but this makes only a few percent. </P>
<P> </P>
<P>In my experiments memory fragmentation can tripple the amount of memory
needed by the codetools. </P>
<P> </P>
<P>AFAIK the several hundred MB of ram needed by the IDE was no problem yet -
even for student machines.</P>
<P style="MARGIN: 0px"> </P>
<P style="MARGIN: 0px"> </P>
<P style="MARGIN: 0px">Mattias</P>
<P><FONT face=Arial color=#0000ff size=2></FONT> </P></BLOCKQUOTE>
<P dir=ltr><SPAN class=578393117-15082011><FONT face=Arial color=#0000ff
size=2>Thanks for that info. That helps a lot.</FONT></SPAN></P>
<P dir=ltr><SPAN class=578393117-15082011><FONT face=Arial color=#0000ff
size=2>Figured out in the meantime that indeed TCodeBuffer.Scanner.Src is the
one hanging on to the source after a TCodeBuffer.IsDeleted:=true and that
TCodeBuffer.Scanner.CleanedSrc has, at first sight, another copy of the source.
Is this really a cache and re-used when reopening the file? With the GTK2
widgedset I see an increase in memory allocated by TCodeBuffer when
opening/closing/reopening the same files.</FONT></SPAN></P>
<P dir=ltr><SPAN class=578393117-15082011><FONT face=Arial color=#0000ff
size=2>Ludo</FONT></SPAN></P></BODY></HTML>