FieldRef suddently slower after about 1000 recx

Hi [8D] I’m using a fieldref to write info into a recordref like this: For every do a lot of times (130.000) approx. — record.init; — for every field in an array list arrFieldNo — — field := record.FIELD(arrFieldNo[i]); — — do something…codecodecode… — record.insert; The problem is that when the outer loop is from 1…1000 approx. the field := record.FIELD(arrFieldNo[i]); Is quite fast, but after that getting the field reference process-time increases exponentially!!! From 1…1000 records is approx. 10 seconds, but from 1000…1300 it is approx. 20 seconds more…!!! Can anyone help me or has the same problem? Best regards Henrik Ohm

Have you tried to perform a similarly intensive task using a different set of functions? Maybe programatically inserting 10.000 journal lines delivers the same kind of performance, on which case the problem - if we can then call it a problem - should be the database having its cache full.

This problem exists because of a memory leak in the RecRef/FieldRef definition. try to put the assignment and insert code into a sub function and define the recref and fieldref there locally. like: For every do a lot of times (130.000) approx. InsertRecord(some parameters); ------- function InsertRecord(some parameters) — record.init; — for every field in an array list arrFieldNo — — field := record.FIELD(arrFieldNo[i]); — — do something…codecodecode… — record.insert; This will heavily increase the speed of the processing. By the way, you can check with the Taskman - Memory usage what happens if you do not.

Heureka!!! That’s the way :smiley: Thank you very much Thomas!! I made a new function “fieldref2recordref(…,…)” that does the sub-assigning of fieldrefs! Have a nice day :slight_smile: Best regards Henrik Ohm

Always welcome, it took me ages to find out this funny workaround. One suggestion in general: Make sure that you never use RecRef variables globally. This leads into huge problems. Use RecordID wherever possible.

What kind of problems, because I pass a recordref around through different functions as a VAR parameter. It seems to work fine now (?)

That is not a problem. But I can send you a small form which crashes Navision because of the memory leakage of the RecRef variable. Sometimes when you define a global variable of the type RecRef and use it in different places it might crash Navision or not free the memory it has been using ending up with a huge memory consumption of the fin.exe and slowing down your system with that.

Yes, please :smiley: Send it. Thank you in advance :slight_smile: Best regards

Here we go: OBJECT Form 55555 Test Navision Crash { OBJECT-PROPERTIES { Date=02/02/05; Time=11:02:45; Modified=Yes; Version List=; } PROPERTIES { Width=8000; Height=8000; OnOpenForm=BEGIN RecRef.OPEN(DATABASE::"Salesperson/Purchaser"); RecRef.FIND('-'); END; } CONTROLS { { 1101070000;TextBox;3300 ;4620 ;3300 ;440 ;SourceExpr=SyncToDo; OnAssistEdit=VAR FRef@1101070000 : FieldRef; BEGIN RecRef.GET(RecRef.RECORDID); FRef := RecRef.FIELD(5105); SyncToDo := FORMAT(STRMENU(FRef.OPTIONSTRING)); END; } { 1101070001;Label ;550 ;770 ;6710 ;3410 ;HorzAlign=Left; VertAlign=Top; MultiLine=Yes; LeaderDots=No; CaptionML=ENU=Navision will crash when you click the AssistEdit button three times } } CODE { VAR RecRef@1101070000 : RecordRef; SyncToDo@1101070001 : Text[250]; BEGIN END. } }

Thomas I’ll look into this - I presume you see the crash on version 3.70?

You can reproduce that crash on 3.60, 3.70, 3.70A, 3.70B and 4.00