renan-guimaraes / dwscript

Automatically exported from code.google.com/p/dwscript
0 stars 0 forks source link

Memory leak in JSON connector #397

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Compiling the following script with leak reporting enabled will report 3x 
TVarExpr objects leaked:

var JsonObj = JSON.Parse('[{"Value": 0}, {"Value": 1}, {"Value": 2}]');

PrintLn(JSON.Stringify(JsonObj));

Original issue reported on code.google.com by masonwhe...@gmail.com on 15 May 2013 at 11:40

GoogleCodeExporter commented 9 years ago
I can't reproduce the leak, anything special or particular compiler options?

Original comment by zar...@gmail.com on 16 May 2013 at 2:15

GoogleCodeExporter commented 9 years ago
Nothing off the top of my head.  This is a simple test script, running under 
the DWS test framework.  The compiler has the JSON Connector and dwsLinq 
extensions attached, but dwsLinq is not being used here so that shouldn't be 
relevant.

Original comment by masonwhe...@gmail.com on 16 May 2013 at 3:15

GoogleCodeExporter commented 9 years ago
If you could add it to the unit tests and see if that's reproducible there? (in 
JSONConnectorPass f.i. or post the snippet here, the first snippet apparently 
wasn't enough to trigger the issue here)

Original comment by zar...@gmail.com on 16 May 2013 at 3:38

GoogleCodeExporter commented 9 years ago
Was an issue in your TJsonFromExpr constructor, the IncRefCount is only 
required when acquiring an extra reference to a ref counted object already 
owned or referenced somewhere else.

TVarExpr are actually unified, but that's done before returning the value, so 
you can use the TVarExpr directly (as if it wasn't reference counted)

Original comment by zar...@gmail.com on 17 May 2013 at 9:44