<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
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:
<blockquote cite="mid:WorldClient-F200705041328.AA28280006@vss.co.nz"
 type="cite"><font style="font-size: 10pt; font-family: tahoma;">
  <div>Hi All. This is a question that might be infulenced by some
serious lack of sleep :-)</div>
  <div>&nbsp;</div>
  <div>I have a funtion. Its return result is a TStringlist.</div>
  <div>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.</div>
  <div>&nbsp;</div>
  <div>Now,&nbsp; this is prob. an obvious answer than I&nbsp;prob. do actually
know, but if I got:-</div>
  <div>&nbsp;</div>
  <div>sResult := TStringList.create;</div>
  <div>sResult.add('blah');</div>
  <div>Result:=sResult;</div>
  <div>&nbsp;</div>
  <div>Then if I free sResult, then I loss the values I added, and the
result is empty as you would expect.</div>
  <div>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?</div>
  <div>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 :-)</div>
  <div>&nbsp;</div>
  <div>Jeremy</div>
  <div>&nbsp;</div>
  <div>&nbsp;</div>
  </font>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe</pre>
</blockquote>
<br>
<div class="moz-signature">-- <br>
<title>Signature</title>
<meta http-equiv="Content-Type" content="text/html; ">
<meta content="MSHTML 6.00.2900.2802" name="GENERATOR">
<div align="left">
<div align="left"><strong><font size="2"><font color="#666666"
 face="Verdana">Rohit Gupta</font></font></strong></div>
<div align="left"><strong><font size="2"><font color="#666666"
 face="Verdana">
B.E.&nbsp;Elec.&nbsp;&nbsp;&nbsp;M.E.&nbsp;&nbsp;&nbsp;Mem&nbsp;IEEE&nbsp;&nbsp;&nbsp;
Associate&nbsp;IEE</font></font></strong></div>
<div align="left"><strong><font size="2"><font color="#666666"
 face="Verdana">Technical&nbsp;Manager</font></font></strong></div>
<div align="left"><strong><font color="#666666" face="Verdana" size="2">Computer
Fanatics Limited</font></strong></div>
<div align="left"><strong></strong>&nbsp;</div>
<div align="left"><font color="#666666" face="Verdana" size="2"><strong>Tel</strong>&nbsp;&nbsp;&nbsp;&nbsp;
+64 9 4892280</font></div>
<div align="left"><font color="#666666" face="Verdana" size="2"><strong>Fax</strong>&nbsp;&nbsp;&nbsp;
+64 9 4892290</font></div>
<div align="left"><font color="#666666"><font face="Verdana" size="2"><strong>Email&nbsp;
</strong></font><a href="mailto:rohit@cfl.co.nz"><font color="#0080ff"
 face="Verdana" size="2">rohit@cfl.co.nz</font></a></font><font
 color="#666666"><font face="Verdana" size="2"><strong></strong></font></font></div>
<div align="left"><font color="#666666"><font face="Verdana" size="2"><strong>Web&nbsp;&nbsp;
&nbsp;</strong></font><a href="http://www.cfl.co.nz/"><font color="#0080ff"
 face="Verdana" size="2">www.cfl.co.nz</font></a></font></div>
<div>&nbsp;</div>
<div>
<hr></div>
<div align="left"><span
 style="font-size: 7.5pt; color: rgb(153, 153, 153); font-family: Verdana;"><font
 size="1"><span style="font-size: 10pt; font-family: 'Courier New';"
 lang="EN-NZ"><font color="#000000"><font color="#808080" face="Verdana"
 size="1">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.</font> <o:p></o:p></font></span></font></span></div>
</div>
</div>
</body>
</html>