#1 2016-09-29 09:46:40

oz
Member
Registered: 2015-09-02
Posts: 95

Issue with TJSONSerializer.RegisterObjArrayForJSON +DEMO

Hi Arnaud,

there is an issue with TJSONSerializer.RegisterObjArrayForJSON. It looks like if there is a limitation to RegisterObjArrayForJSON. When adding the 126th T*ObjArray<->T* pair, all T*ObjArray params start leaking memory on server side. My last post in http://synopse.info/forum/viewtopic.php?id=3559 describes what is happening then.

I've attached a demo program to reproduce the issue, you can download from: http://www.megafileupload.com/g1ez/MemLeakTest.zip

Compile and run the program, everything works as expected.
Enable conditional define {$DEFINE SHOWBUG} and .GetAll(TTestObjArray) leaks memory. 1000 instances of TTest are not destroyed, because TJSONSerrializer is broken.

It took me some time to find out what's happening here, i hope my test helps.

Kind regards,
oz.

Offline

#2 2016-10-05 10:15:55

oz
Member
Registered: 2015-09-02
Posts: 95

Re: Issue with TJSONSerializer.RegisterObjArrayForJSON +DEMO

I've created a ticket for this issue http://synopse.info/fossil/tktview/954f … 2786231833 . Demo code is attached in ticket description and can be copy&pasted to an empty .dpr file.
Arnaud, did you have time to run the demo? It's quite a serious low level issue i guess...

Last edited by oz (2016-10-05 10:16:16)

Offline

#3 2016-10-06 17:02:13

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,238
Website

Re: Issue with TJSONSerializer.RegisterObjArrayForJSON +DEMO

I think I've found the root causes.
See http://synopse.info/fossil/info/5e9bb92e87

Thanks to your demo program, I was able to make the fix.

Thanks a lot!

Offline

#4 2016-10-11 10:17:37

oz
Member
Registered: 2015-09-02
Posts: 95

Re: Issue with TJSONSerializer.RegisterObjArrayForJSON +DEMO

You're welcome, i'm happy my demo program did help!
I just did some tests, the issue is gone, thanks. smile

Offline

Board footer

Powered by FluxBB