#1 Yesterday 09:42:46

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 515

ArrayFinalize: Integer has refcnt=2"

The last month I am getting the following in unpredicted times:
20260129 09242262  ! EXC   ERttiException {Message:"TRttiJson.ArrayFinalize: Integer has refcnt=2"} [Main] at 9af2db mormot.core.rtti.pas TRttiCustom.NoRttiArrayFinalize (9342)  {6 2.43 2.62 4.6GB/7.7GB 66581b01}
windows Delphi 12.3 & 13.0

Where should I check for that?

Last edited by dcoun (Yesterday 09:51:24)

Offline

#2 Yesterday 10:30:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,397
Website

Re: ArrayFinalize: Integer has refcnt=2"

I guess you are using a dynamic array of integers field in text-based JSON serialization.
Try to make a copy() of this field if you store it somewhere.

Offline

#3 Yesterday 11:01:45

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 515

Re: ArrayFinalize: Integer has refcnt=2"

Is array of Integer different to Tarray<Integer> ? In delphi there are differences
Is there a way to get more debug, like in which record type (that has the integer array) it happed?

Offline

#4 Yesterday 12:12:52

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,397
Website

Re: ArrayFinalize: Integer has refcnt=2"

There is no difference between "TArray<integer>" and "array of integer" from the compiler point of view.
But the compiler is not the issue here.

Since it is from text definition, there is no type attached to itself. And the record type is not known in the current context...

But I guess expecting RefCnt=1 was plain wrong.
Please try with
https://github.com/synopse/mORMot2/commit/5ef4db849

Offline

#5 Yesterday 12:33:35

dcoun
Member
From: Crete, Greece
Registered: 2020-02-18
Posts: 515

Re: ArrayFinalize: Integer has refcnt=2"

To be honest, not all the record definitions involved in the part of the code that produced the error where declared with TRttiJson.RegisterFromText
I have changed it after this error.
I will test the commit
Thank you ab

Offline

Board footer

Powered by FluxBB