Periodically we receive requests where customers asking us about RTC print preview consumes all available memory and computers hangs.
Repro scenarios are more/less similar: run report, click preview, go per pages up/down, close report. Run another report, click preview, go per pages up down and… RTC hangs. If we look to memory usage, NAV is using all available memory.
If we analyze what has happened, we see: with every move per pages memory usage increase and increase and increase until all memory is used. It looks like typical memory leak because in NAV 2009 with the same repro everything is OK.
However it is not so simple. What NAV does in this scenario is: it loads Microsoft Report Viewer 2010 with 2 files: report definition (RDL file where is described report structure) and record set. And that is all, next actions like preview/print/export are managed by report viewer. The same we have in NAV 2009 just it loads Report Viewer 2008 and .NET Framework 3.5 as NAV 2013 uses Report Viewer 2010 and .NET Framework 4.5. And here is reason pointing us to memory usage behavior: Report Viewer 2010 and .NET 4.5 uses another way to manage memory (named more advanced and more secure). However this ‘another’ way gets us mentioned questions from customers and really we can do nothing from NAV platform side – system works as it is designed to work.
But things are not so bad. In .NET memory is managed very smart and not used memory is released by function named ‘garbage collector’. This function periodically review memory blocks and release not used. And actually it works: if we monitor memory during report previewing and after it close we see that in preview and going per pages memory usage increase, after preview close memory usage is still the same, but after 5-10 min used memory decrease to initial numbers. For example in my tests started RTC using 98.5 MB, after few previews and scrolls and etc. usage increases to 215 MB and doesn’t decrease if I close preview. But after few minutes garbage collector returns usage to 100.4 MB. We can force (in NAV platform) garbage collector to work faster and memory release will be faster, but this will increase processor usage and in many cases it is worse than memory usage.
Few trick could help users do not meet memory problems:
These postings are provided "AS IS" with no warranties and confer no rights. You assume all risk for your use.
Gedas BusniauskasMicrosoft LithuaniaMicrosoft Customer Service and Support (CSS) EMEA
Other Microsoft Sites
I'm a Customer
I'm a Partner
Follow Microsoft Dynamics