So I found this wonderfull way to create a memory leak in DF that has taken me half a day to debug.

Here is an example:
Code:
Function TestReplace String sText Returns Boolean
    Move (Trim(sText)) to sText
    Function_Return False
End_Function
Code:
Boolean bIsNumeric
Variant vText

Move '[{"z04":2,"z07":486.5000,"z08":0.0000,"z03":27,"z09":0.00,"z19":0.00,"z21":0.00,"z15":0.00,"z16":0,"z17":"1753-01-01T00:00:00","z18":"1753-01-01T00:00:00","z22":0.00,"z23":0,"z24"' to vText
Append vText (':"1753-01-01T00:00:00","z25":"1753-01-01T00:00:00","z28":0.0000,"Z29":0.00,"z30":0,"z31":"1753-01-01T00:00:00","Z32":"1753-01-01T00:00:00","Z33":0.00,"Z34":0,"Z35"')
Append vText (':"1753-01-01T00:00:00","Z36":"1753-01-01T00:00:00","Z37":0.00,"Z38":0,"Z39":"1753-01-01T00:00:00","Z40":"1753-01-01T00:00:00","Z41":0.00,"Z42":0,"Z43"')
Append vText (':"1753-01-01T00:00:00","Z44":"1753-01-01T00:00:00","z46":0.00,"z47":"1753-01-01T00:00:00","z48":"1753-01-01T00:00:00"}]')

For i from 1 to 500000
    Get TestReplace vText to bIsNumeric
Loop
This results in a HUGE memory leak. Seems like this happens because we move something to the local variable in the TestReplace function.
So the Variant is not automatically "converted" to a String when passing it to the function? I'm just suprised we never got any errors either or invalid memory access or w/e.

Ofcourse now that we know this "problem" it's easy to solve by wrapping the Variant in a String().

Code without the memory leak:
Code:
Boolean bIsNumeric
Variant vText

Move '[{"z04":2,"z07":486.5000,"z08":0.0000,"z03":27,"z09":0.00,"z19":0.00,"z21":0.00,"z15":0.00,"z16":0,"z17":"1753-01-01T00:00:00","z18":"1753-01-01T00:00:00","z22":0.00,"z23":0,"z24"' to vText
Append vText (':"1753-01-01T00:00:00","z25":"1753-01-01T00:00:00","z28":0.0000,"Z29":0.00,"z30":0,"z31":"1753-01-01T00:00:00","Z32":"1753-01-01T00:00:00","Z33":0.00,"Z34":0,"Z35"')
Append vText (':"1753-01-01T00:00:00","Z36":"1753-01-01T00:00:00","Z37":0.00,"Z38":0,"Z39":"1753-01-01T00:00:00","Z40":"1753-01-01T00:00:00","Z41":0.00,"Z42":0,"Z43"')
Append vText (':"1753-01-01T00:00:00","Z44":"1753-01-01T00:00:00","z46":0.00,"z47":"1753-01-01T00:00:00","z48":"1753-01-01T00:00:00"}]')

For i from 1 to 500000
    Get TestReplace (String(vText)) to bIsNumeric
Loop