Tip: Custom counters file view is out of memory when using Web Services

Tip: Custom counters file view is out of memory when using Web Services

  

Symptoms:

Sometimes, when invoking web service methods, a runtime error occurs with the specified error message:


"Custom counters file view is out of memory."


Cause:

This error occurs when the ASP.NET process memory dedicated to custom performance counters instantiation fills up, due to a lot of Web Services invocations in a short period of time. Basically, the garbage collection mechanism of ASP.NET framework isn't fast enough to clear the performance counters memory used by the OutSystems counters, or is not doing it at all.

Resolution:

In almost every scenario, a reboot of the server clears the custom performance counters used memory and solves the problem, if it arises due to an usual Web Service invocations period (like during extensive testing). Although it would suggest that an IIS reset would do the trick, usually is not the case, which leads to believe that this custom performance counter memory is outside the ASP.NET worker process (and somewhere in the system).

Fortunately, ASP.NET provides a way to specify the amount of memory used for these performance counters. In a .config file (machine.config for wide configurations, or app.config for application level configurations) is possible to define the amount of memory using the filemappingsize setting. By default is 524288 (512KB), and it can be set in the system.diagnostics section like shown below.

<configuration>
<system.diagnostics>
<performanceCounters filemappingsize="524288" />
</system.diagnostics>
</configuration>


You can increase the defined value to increase the memory allocated to the custom performance counters, at your own discretion.

Cheers

-----------------------------------------------------
Best Regards

Miguel Simões João