ahausladen / JsonDataObjects

JSON parser for Delphi 2009 and newer
MIT License
413 stars 160 forks source link

String reference count issue in ARM64 #19

Closed kstrophus closed 8 years ago

kstrophus commented 8 years ago

Amazing work on issue #18! I get a JSON string now in ARM64!

But something is wrong with the string reference count I think. When the JSON string that gets returned goes out of scope an exception is raised. Consider this code:

procedure TForm1.Button1Click(Sender: TObject); var jo: TJSONObject; s: string; begin jo := TJSONObject.Create; jo.S['USERID'] := 'S.TESTER'; s := jo.ToJSON(true); // Get a value now :) s := ''; // Exception :( jo.Free; end;

Exception is also raised if I do not set the string to empty and the method ends (string goes out of scope). This is where the exception is:

function System._UStrClr() 24641: FreeMem(P);

kstrophus commented 8 years ago

The memory exception when the resulting JSON string goes out of scope is only thrown in ARM64. Other targets seem fine.

kstrophus commented 8 years ago

Thank you! :)