<br><br><div class="gmail_quote">On 18 December 2011 17:34, silvioprog <span dir="ltr"><<a href="mailto:silvioprog@gmail.com">silvioprog@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2011/12/18 ik <<a href="mailto:idokan@gmail.com">idokan@gmail.com</a>>:<br>
<div class="im">> Hello,<br>
><br>
> I'm using FPC 2.6 (rc) x86_64 on Linux with JSONParser.<br>
><br>
> I've written the following code:<br>
<br>
</div>Use:<br>
<br>
var<br>
parser: TJSONParser;<br>
json_data: TJSONData;<br>
json_file: TFileStream;<br>
begin<br>
json_file := TFileStream.Create('test.json', fmOpenRead);<br>
parser := TJSONParser.Create(json_file);<br>
json_data := parser.Parse;<br>
WriteLn(json_data.AsJSON);<br>
json_data.Free;<br>
json_file.Free;<br>
parser.Free;<br>
end;<br>
<br>
Thx.<br>
<br></blockquote><div><br>I am getting some issues with memory leaks and want to see if this topic sheds some light on the issue.<br>From the original posters question it appears that parse.Parse.AsJSON create an object which needed to be free although there was no explicit Txxx.Create in the code.<br>
<br>>writeln('JSON: ', parser.Parse.AsJSON);<br>
<br>Does this represent a common case where using AsXXX creates an object?<br><br> Is there some way of telling whether some types of functions create objects which need to be freed even although they do not offer handles which can be used to free them?<br>
<br>It looks to me that lot of leaky code is created which looks right unless you know more about the functions used create objects..<br><br>I am using the XML libraries and beginning to suspect that lots of this kind of problem are lurking within the code I am writing.<br>
<br><br>PS. Does every 'Call trace xxx' represent an object created that wasn't freed? I asked about this in another thread but haven't gotten a reply yet<br><br> </div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
--<br>
Silvio Clécio<br>
===============================================<br>
Blog - <<a href="http://silvioprog.com.br" target="_blank">silvioprog.com.br</a>><br>
Twitter - <<a href="http://twitter.com/silvioprog" target="_blank">twitter.com/silvioprog</a>><br>
Facebook - <<a href="http://facebook.com/silvioclecio" target="_blank">facebook.com/silvioclecio</a>><br>
LazSolutions - <<a href="http://code.google.com/p/lazsolutions" target="_blank">code.google.com/p/lazsolutions</a>><br>
Lazarus-BR - <<a href="http://groups.google.com.br/group/lazarus-br?hl=pt-BR" target="_blank">groups.google.com.br/group/lazarus-br?hl=pt-BR</a>><br>
===============================================<br>
* Conheça nosso canal IRC sobre Lazarus: #lazarus-br *<br>
===============================================<br>
_______________________________________________<br>
fpc-pascal maillist - <a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a><br>
<a href="http://lists.freepascal.org/mailman/listinfo/fpc-pascal" target="_blank">http://lists.freepascal.org/mailman/listinfo/fpc-pascal</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Frank Church<br><br>=======================<br><a href="http://devblog.brahmancreations.com">http://devblog.brahmancreations.com</a><br>