We already had few support request where NAV developers see big memory consumption increase when using .NET component.
Especially when method is inside some loop.
Like in this sample:
FOR count := 1 TO 10000000 DO BEGIN
Even it looks like we create variable and then clear it – we can see continues memory usage increase in windows task manager.
But this is not “memory leak” this is how NAV is managing memory. If you start process again then memory usage decrease and increase to the same number.
So only during processing there could be issue that few users running the same code comes to memory limits.
Resolution is to transfer .NET method execution to local function
FOR count := 1 TO 10000000 DO
PROCEDURE CallToFunction@1(parameter@1170000001 : Text);
varDOTNET@1170000000 : DotNet "'MemoryExample, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null'.MemoryExample.DotNetObject";
Also here are other coding ways where you can transfer part DotNet variable execution to functions. But it is always more effective transfer execution to function where "garbage collector" can make his job faster and more effective.
These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.
Microsoft Customer Service and Support (CSS) EMEA