<div dir="ltr">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>-----------------------<br>uses fpjson, jsonparser, SysUtils, classes;<br><br>var<br>
parser : TJSONParser;<br> json_file : TFileStream; <br><br>begin<br> json_file := TFileStream.Create('/tmp/test.json', fmOpenRead);<br> json_file.position := 0;<br> parser := TJSONParser.create(json_file);<br>
writeln('JSON: ', parser.Parse.AsJSON);<br> FreeAndNil(parser);<br> FreeAndNil(json_file);<br>end.<br>---------------------<br><br>It works well, but compiling with -gh gives the following return:<br>$ ./test_json <br>
JSON: { "Hello" : "World", "TheAnswerForWorldUniverseAndEverything" : 42, "Array" : ["a", 1, 3.14000000000000E+000] }<br>Heap dump by heaptrc unit<br>70 memory blocks allocated : 7060/7208<br>
53 memory blocks freed : 6274/6408<br>17 unfreed memory blocks : 786<br>True heap size : 458752<br>True free heap : 455296<br>Should be : 455776<br>Call trace for block $00007FA261D57660 size 16<br> $000000000042BB8C<br>
$000000000042B974<br> $000000000042BEA7<br> $000000000042B94F<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D575C0 size 16<br> $000000000042BAED<br>
$000000000042B974<br> $000000000042BEA7<br> $000000000042B94F<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D67E40 size 32<br> $000000000041637A<br>
$000000000042B94F<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D57520 size 16<br> $000000000042B918<br> $000000000042BEA7<br> $000000000042B94F<br>
$000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D67D80 size 18<br> $0000000000499691<br> $000000000042B94F<br> $000000000042BCF8<br> $000000000042B92A<br>
$000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D67CC0 size 24<br> $000000000047C0D8<br> $000000000047BE34<br> $0000000000428B13<br> $000000000042BE45<br> $000000000042B94F<br> $000000000042BCF8<br>
$000000000042B92A<br> $000000000042B663<br>Call trace for block $00007FA261D67C00 size 24<br> $0000000000428B13<br> $000000000042BE45<br> $000000000042B94F<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br>
$0000000000400180<br>Call trace for block $00007FA261D57480 size 16<br> $000000000042BE45<br> $000000000042B94F<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D57340 size 16<br>
$000000000042BAED<br> $000000000042B974<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br> $0000000000400180<br>Call trace for block $00007FA261D5F520 size 70<br> $000000000041637A<br>
$000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D67B40 size 20<br> $000000000041637A<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D470C0 size 384<br>
$000000000041637A<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D573E0 size 16<br> $000000000042B918<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br>
$0000000000400180<br>Call trace for block $00007FA261D67A80 size 22<br> $0000000000499691<br> $000000000042BCF8<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D5F440 size 56<br>
$000000000047EA32<br> $000000000042A53B<br> $000000000042BC43<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D67900 size 24<br> $000000000042A53B<br> $000000000042BC43<br>
$000000000042B92A<br> $000000000042B663<br> $0000000000400180<br>Call trace for block $00007FA261D572A0 size 16<br> $000000000042BC43<br> $000000000042B92A<br> $000000000042B663<br> $0000000000400180<br><br><br>Is that a memory leak in the library, or am I missing something here ?<br>
Thanks,<br>Ido<br>
</div>