I download a stream of records as I type this note. They are punctuated by some other records. In short it is a batch of about of 265 streams. Twice in the process I get the OutOfMemoryException.
It is not the first time. When it happened before I did not have a try/catch block around the code and had to abort. Now it just goes aroung it. It is a nuisance code: a timer that gives me convenience of knowing that the things proceed at a certain pace I am used to. I also have a memory usage from PerformanceMonitor on my TabPage where all other events related to download are reflected. As far as I can tell, the memory usage is low throughout and it did not change when the exceptions were thrown.
The call stack is posted below. The entry point is the timer1_Tick delegate but the rest of it I cannot analyze meaningfully. I do not know this stuff too well.
Exception of type 'System.OutOfMemoryException' was thrown.
at Microsoft.Win32.RegistryKey.InternalGetValue(String name, Object defaultValue, Boolean doNotExpand, Boolean checkSecurity)
at Microsoft.Win32.RegistryKey.GetValue(String name)
at System.Diagnostics.PerformanceMonitor.GetData(String item)
at System.Diagnostics.PerformanceCounterLib.GetPerformanceData(String item)
at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String category)
at System.Diagnostics.PerformanceCounterLib.GetCategorySample(String machine, String category)
at tapTCPports_1.Form1.timer1_Tick(Object sender, EventArgs ee) in D:\VCsharp_Projects\tapTCPports_1\Form1.cs:line 3957
I will appreciate any comment.