You are not logged in.
Pages: 1
Hi,
first of all happy new year
i have update mormot framework from 01/2017 to last nightly build and i have a problem with RTTI in a unit where i use TDynArray.
The problem (Access Violation) appear only in Release mode, not in Debug mode.
i think is something about this in mormot.pas
{.$define USETYPEINFO} // define for debugg, not on production
but i don't understand why and how resolve.
anyone can help me?
thanks
Emanuele.
Offline
Ab have any idea?
Offline
you're right mvp
i work on delphi 10.1 berlin 32bit
array declaration
TRigaDocumento = record
IDArticolo: TID;
Tipo: TTipoRigaDocumento;
Codice: RawUTF8;
Descrizione: RawUTF8;
Quantita: Double;
UnitaMisura: RawUTF8;
PrezzoUnitario: Double;
TipoPrezzo: TTipoPrezzo;
Aliquota: Double;
PercentualeScontoMaggiorazione1: Double;
PercentualeScontoMaggiorazione2: Double;
PercentualeScontoMaggiorazione3: Double;
Lotto: RawUTF8;
Reparto: RawUTF8;
function getPrezzoNetto: Double;
function getPrezzoLordo: Double;
function getImponibile: Double;
function getImposta: Double;
function getTotale: Double;
function getPercentualeScontoMaggiorazioneTotale: Double;
function getImportoScontoMaggiorazioneTotale: Double;
property PrezzoNetto: Double read getPrezzoNetto;
property PrezzoLordo: Double read getPrezzoLordo;
property Imponibile: Double read getImponibile;
property Imposta: Double read getImposta;
property Totale: Double read getTotale;
property PercentualeScontoMaggiorazioneTotale: Double read getPercentualeScontoMaggiorazioneTotale;
property ImportoScontoMaggiorazioneTotale: Double read getImportoScontoMaggiorazioneTotale;
end;
TRigheDocumento = array of TRigaDocumento;
DynArray init (where self.DARigheDocumento is TDynArray variable and aRigheDocumento is TRigheDocumento variable)
self.DARigheDocumento.Init(System.Typeinfo(TRigheDocumento), aRigheDocumento);
example operation with AV
self.DARigheDocumento.ElemCopyAt(aIndex, aRigaDocumento);
There is problem after the update of mORMot framework version '1.18.3372' to version '1.18.4932'
the Access Violation there is only in Release mode. In Debug mode all work fine.
if you need other information ask me obviously.
thanks a lot
Offline
Your record should be packed I guess.
But I don't see why it shouldn't work any more.
Try first to find out why there is a problem, debugging your code.
Please provide a simple reproducible sample, not as copy & paste in this forum, but as github or pastebin.
Offline
hi ab,
the problem in the problem is often that in debug mode all work like a charm! so i cant debug!
Offline
hi ab,
enabling debug information on release mode i can step by step into the line of code that cause the access violation
in SynCommons.pas
procedure CopyArray(dest, source, typeInfo: Pointer; cnt: PtrUInt);
asm
{$ifdef CPU64}
.NOFRAME
jmp System.@CopyArray
{$else} push dword ptr[EBP + 8]
call System.@CopyArray // RTL is fast enough for this <------ACCESS VIOLATION
{$endif}
end;
the same operation in debug mode work well.
i create a new option (call production) copy from Release and disable optimization flag and ALL WORK FINE.
this can help?
Thanks
Last edited by lele9 (2019-01-09 08:05:54)
Offline
I am not able to reproduce anything like what you report with Delphi 10.3 CE in Win32 Release mode.
I just run the regression tests with no problem.
Offline
Pages: 1