I have an application in C#, Framework 4. Very basically, this application mainly react to events and creates objects, release them, create database connection and close them.
Now, we've been seeing that the application's process grows sometimes in very strange ways. We've got two different behaviors :
- The application grows until reaching up to 4 GB in RAM when usually it "should" stay at around 500 MB. Consequence -> it crashes!
- The application grows slowly up to 1200 MB (30 minutes) and then abruptly shrinks to 500 MB (in one second)... and this process repeats itself every now and then. Can this be Garbage Collector in action ?
Now, in order to provide us with more informations about the application, I would like to add in our log files the size of the application's process. Is it possible through the native framework ? Is it possible to know an object' size in C# ?
I've also found the application NetMemoryProfiler4 but I would prefer to use embedded logging if it's possible !