I would like to write the following code in c#.
a) small console application that simulates memory leak.
b) small console application that would invoke the above application and release it right away simulating managing memory leak problem..
In other words the (b) application would continuously call and release application (a) to simulate how the “rebellious” memory leak application is being contained with out addressing the root cause which is application (a).
Some sample code for application (a) and (b) would be very helpful.
Thanks
The leaking application might look like:
And the calling application might look like:
Take a look at the properties on the Process class. There are several that return how much memory the process is consuming. You may be able to use one of them to conditionally kill the process.