<!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:st1 = 
"urn:schemas-microsoft-com:office:smarttags"><HEAD><TITLE>Signature</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3059" name=GENERATOR><!--[if !mso]>
<STYLE>v\:* {
        BEHAVIOR: url(#default#VML)
}
o\:* {
        BEHAVIOR: url(#default#VML)
}
w\:* {
        BEHAVIOR: url(#default#VML)
}
.shape {
        BEHAVIOR: url(#default#VML)
}
</STYLE>
<![endif]--><o:SmartTagType name="place" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><o:SmartTagType 
name="PersonName" 
namespaceuri="urn:schemas-microsoft-com:office:smarttags"></o:SmartTagType><!--[if !mso]>
<STYLE>st1\:* {
        BEHAVIOR: url(#default#ieooui)
}
</STYLE>
<![endif]-->
<STYLE>@font-face {
        font-family: MS Mincho;
}
@font-face {
        font-family: Tahoma;
}
@font-face {
        font-family: Verdana;
}
@font-face {
        font-family: @MS Mincho;
}
@page Section1 {size: 8.5in 11.0in; margin: 1.0in 1.25in 1.0in 1.25in; }
P.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: "Times New Roman"
}
LI.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: "Times New Roman"
}
DIV.MsoNormal {
        FONT-SIZE: 12pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: "Times New Roman"
}
A:link {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlink {
        COLOR: blue; TEXT-DECORATION: underline
}
A:visited {
        COLOR: blue; TEXT-DECORATION: underline
}
SPAN.MsoHyperlinkFollowed {
        COLOR: blue; TEXT-DECORATION: underline
}
PRE {
        FONT-SIZE: 10pt; MARGIN: 0in 0in 0pt; COLOR: black; FONT-FAMILY: "Courier New"
}
SPAN.EmailStyle19 {
        COLOR: navy; FONT-FAMILY: Arial; mso-style-type: personal-reply
}
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=blue link=blue bgColor=white>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=428154604-04052007>
<P class=MsoNormal><SPAN lang=SV 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><SPAN 
class=428154604-04052007>I think PopulateList should be guarded by 
try.</SPAN></SPAN></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Procedure 
DoSomthing;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Var<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; List : 
TStrings;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Begin<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">List := 
TStringList.Create;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">try<o:p></o:p></SPAN></FONT></P><FONT 
face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;PopulateList(List);&nbsp;&nbsp;&nbsp; 
<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt">&nbsp;&nbsp;if List.Count &gt; 0 
then<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
begin<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp; 
&#8230;do lots of stuff with the list<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
End;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Finally<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;List.Free;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;</SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><SPAN 
class=428154604-04052007>I would write this one like this</SPAN></SPAN></P><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><SPAN 
class=428154604-04052007>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Procedure 
DoSomthing;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Var<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; List : 
TStrings;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Begin<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">List := 
GetLoadsOfStrings;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></P><FONT 
face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;if 
assigned(List) then<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
begin<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt">try<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp; 
&#8230;do lots of stuff with the list<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Finally<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;List.Free;<o:p></o:p></SPAN></FONT></P>
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;</SPAN></FONT></P><FONT 
face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">
<P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" color=navy 
size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
End;<o:p></o:p></SPAN></FONT></P><o:p></o:p></SPAN></FONT>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;<o:p></o:p></SPAN></FONT></P></SPAN></SPAN>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"></SPAN></FONT>&nbsp;</P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p><SPAN 
class=428154604-04052007>Regards</SPAN></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p><SPAN 
class=428154604-04052007>Leigh</SPAN></o:p></SPAN></P>
<P class=MsoNormal><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p><SPAN 
class=428154604-04052007><A 
href="http://www.smootharm.com">www.smootharm.com</A></SPAN></o:p></SPAN></P>
<P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></P></SPAN></FONT></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> delphi-bounces@delphi.org.nz 
  [mailto:delphi-bounces@delphi.org.nz]<B>On Behalf Of </B>Tim 
  Jarvis<BR><B>Sent:</B> Friday, 4 May 2007 4:30 p.m.<BR><B>To:</B> NZ Borland 
  Developers Group - Delphi List; vss@vss.co.nz<BR><B>Subject:</B> RE: [DUG] 
  Dumb Friday Question<BR><BR></FONT></DIV>
  <DIV class=Section1>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hi 
  Guys,<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Hope you don&#8217;t mind 
  me sticking my nose in here. Firstly I agree with the sentiment that you 
  should try and avoid creating objects in one place and freeing in another, 
  however I don&#8217;t think that this situation represents that, think of a function 
  that returns a class as a factory method, these obviously are quite common and 
  not bad practice at all, in fact a constructor is a factory type 
  method.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Procedure 
  DoSomthing;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Var<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; List : 
  TStrings;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Begin<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">List := 
  GetLoadsOfStrings;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">try<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;if 
  assigned(List) then<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
  begin<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp; 
  &#8230;do lots of stuff with the list<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
  End;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Finally<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;List.Free;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Is really not much 
  different from <o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Procedure 
  DoSomthing;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Var<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN lang=SV 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; List : 
  TStrings;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Begin<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">List := 
  TStringList.Create;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;PopulateList(List);&nbsp;&nbsp;&nbsp; 
  <o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">try<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;if 
  List.Count &gt; 0 then<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
  begin<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp; 
  &#8230;do lots of stuff with the list<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp; 
  End;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">Finally<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">&nbsp;&nbsp;List.Free;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal style="TEXT-INDENT: 6pt"><FONT face="Courier New" 
  color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'">End;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Courier New" color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: 'Courier New'"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">The issue is where 
  the variable is declared, and the scope of the ownership not the act of 
  creation, creation is fine to delegate to a factory type 
  method.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial">Regards 
  Tim.<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face=Arial color=navy size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: navy; FONT-FAMILY: Arial"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <DIV>
  <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT 
  face="Times New Roman" color=black size=3><SPAN 
  style="FONT-SIZE: 12pt; COLOR: windowtext">
  <HR tabIndex=-1 align=center width="100%" SIZE=3>
  </SPAN></FONT></DIV>
  <P class=MsoNormal><B><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: windowtext; FONT-FAMILY: Tahoma">From:</SPAN></FONT></B><FONT 
  face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: windowtext; FONT-FAMILY: Tahoma"> 
  delphi-bounces@delphi.org.nz [mailto:delphi-bounces@delphi.org.nz] <B><SPAN 
  style="FONT-WEIGHT: bold">On Behalf Of </SPAN></B>Rohit Gupta<BR><B><SPAN 
  style="FONT-WEIGHT: bold">Sent:</SPAN></B> Friday, 4 May 2007 12:22 
  PM<BR><B><SPAN style="FONT-WEIGHT: bold">To:</SPAN></B> vss@vss.co.nz; 
  <st1:PersonName w:st="on">NZ Borland Developers Group - Delphi 
  List</st1:PersonName><BR><B><SPAN 
  style="FONT-WEIGHT: bold">Subject:</SPAN></B> Re: [DUG] Dumb Friday 
  Question</SPAN></FONT><FONT color=black><SPAN 
  style="COLOR: windowtext"><o:p></o:p></SPAN></FONT></P></DIV>
  <P class=MsoNormal><FONT face="Times New Roman" color=black size=3><SPAN 
  style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <P class=MsoNormal><FONT face="Times New Roman" color=black size=3><SPAN 
  style="FONT-SIZE: 12pt">I would go along with Robert, you should not return 
  complex types from functions that create them,&nbsp;&nbsp; It makes the code 
  messy, you create it in one place and free it in another.&nbsp; Any sort of 
  code analyser would also complain about this.&nbsp; You could return a string 
  = stringlist.text and assign it to a local stringlist.<BR><BR>Jeremy Coulter 
  wrote: <o:p></o:p></SPAN></FONT></P>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">Hi All. This is a question that 
  might be infulenced by some serious lack of sleep 
  :-)<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">I have a funtion. Its return 
  result is a TStringlist.<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">In my code I&nbsp;create 
  a&nbsp;TStringlist then add my values to it, then pass this to the RESULT 
  varaible for the function.<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">Now,&nbsp; this is prob. an 
  obvious answer than I&nbsp;prob. do actually know, but if I 
  got:-<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">sResult := 
  TStringList.create;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">sResult.add('blah');<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">Result:=sResult;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">Then if I free sResult, then I 
  loss the values I added, and the result is empty as you would 
  expect.<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">But the issue I have is, so if I 
  DONT free sResults, what happens to it? Surley it stays in memory,a dn I would 
  end up with a memory leack after repeaditive calls. Is that right? Or is 
  because the variable is function specific its free by default 
  etc?<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">Its a basic question I 
  know....but the more I thought about it the more uncertain I became....I 
  really need some sleep so that prob. the real probelm 
  :-)<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">Jeremy<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <P class=MsoNormal><FONT face=Tahoma color=black size=2><SPAN 
  style="FONT-SIZE: 10pt; FONT-FAMILY: Tahoma">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV><PRE wrap=""><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></FONT></PRE><PRE style="TEXT-ALIGN: center"><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt">

<HR align=center width="90%" SIZE=4>

</SPAN></FONT></PRE><PRE><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt"><o:p>&nbsp;</o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt">_______________________________________________<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt">NZ Borland Developers Group - <st1:place w:st="on">Delphi</st1:place> mailing list<o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt">Post: <A href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</A><o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt">Admin: <A href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</A><o:p></o:p></SPAN></FONT></PRE><PRE><FONT face="Courier New" color=black size=2><SPAN style="FONT-SIZE: 10pt">Unsubscribe: send an email to <A href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</A> with Subject: unsubscribe<o:p></o:p></SPAN></FONT></PRE>
  <P class=MsoNormal><FONT face="Times New Roman" color=black size=3><SPAN 
  style="FONT-SIZE: 12pt"><o:p>&nbsp;</o:p></SPAN></FONT></P>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" color=black size=3><SPAN 
  style="FONT-SIZE: 12pt">-- <o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">Rohit 
  Gupta</SPAN></FONT></B></STRONG><o:p></o:p></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">B.E.&nbsp;Elec.&nbsp;&nbsp;&nbsp;M.E.&nbsp;&nbsp;&nbsp;Mem&nbsp;IEEE&nbsp;&nbsp;&nbsp; 
  Associate&nbsp;IEE</SPAN></FONT></B></STRONG><o:p></o:p></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">Technical&nbsp;Manager</SPAN></FONT></B></STRONG><o:p></o:p></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">Computer 
  Fanatics Limited</SPAN></FONT></B></STRONG><o:p></o:p></P>
  <P class=MsoNormal><FONT face="Times New Roman" color=black size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">Tel</SPAN></FONT></B></STRONG><FONT 
  face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp;&nbsp; 
  +64 9 4892280</SPAN></FONT><o:p></o:p></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">Fax</SPAN></FONT></B></STRONG><FONT 
  face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">&nbsp;&nbsp;&nbsp; 
  +64 9 4892290</SPAN></FONT><o:p></o:p></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">Email&nbsp; 
  </SPAN></FONT></B></STRONG><FONT color=#666666><SPAN style="COLOR: #666666"><A 
  href="mailto:rohit@cfl.co.nz"><FONT face=Verdana color=#0080ff size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #0080ff; FONT-FAMILY: Verdana">rohit@cfl.co.nz</SPAN></FONT></A></SPAN></FONT><o:p></o:p></P>
  <P class=MsoNormal><STRONG><B><FONT face=Verdana color=#666666 size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #666666; FONT-FAMILY: Verdana">Web&nbsp;&nbsp; 
  &nbsp;</SPAN></FONT></B></STRONG><FONT color=#666666><SPAN 
  style="COLOR: #666666"><A href="http://www.cfl.co.nz/"><FONT face=Verdana 
  color=#0080ff size=2><SPAN 
  style="FONT-SIZE: 10pt; COLOR: #0080ff; FONT-FAMILY: Verdana">www.cfl.co.nz</SPAN></FONT></A></SPAN></FONT><o:p></o:p></P>
  <DIV>
  <P class=MsoNormal><FONT face="Times New Roman" color=black size=3><SPAN 
  style="FONT-SIZE: 12pt">&nbsp;<o:p></o:p></SPAN></FONT></P></DIV>
  <DIV>
  <DIV class=MsoNormal style="TEXT-ALIGN: center" align=center><FONT 
  face="Times New Roman" color=black size=3><SPAN style="FONT-SIZE: 12pt">
  <HR align=center width="100%" SIZE=3>
  </SPAN></FONT></DIV></DIV>
  <P class=MsoNormal><FONT face=Verdana color=gray size=1><SPAN lang=EN-NZ 
  style="FONT-SIZE: 7.5pt; COLOR: gray; FONT-FAMILY: Verdana">This email and any 
  attachments contain information, which is confidential and may be subject to 
  legal privilege and copyright. If you are not the intended recipient, you must 
  not use, distribute or copy this email or attachments. If you have received 
  this in error, please notify us immediately by return email and then delete 
  this email and any attachments.</SPAN></FONT><FONT face="Courier New" 
  size=2><SPAN lang=EN-NZ style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"> 
  </SPAN><U1:P></U1:P></FONT><o:p></o:p></P></DIV></DIV></BLOCKQUOTE></BODY></HTML>