Ginanity Posted March 13, 2007 Posted March 13, 2007 i'm not sure where to post this so ive put it in general. Basicly i'm building a web developer (html/php editor with precodes etc) and i also wrote a debug system that automaticly catches errors etc. Now i was wondering if its possible to monitor the memory use of my application in orde to shut it down automaticly on memory leak? Is this even possible in .net and what library should i use? thx in advantage, Anti Quote
Leaders snarfblam Posted March 13, 2007 Leaders Posted March 13, 2007 An important point in the design of the DotNet framework is that memory leaks are very difficult to create. There are only two ways to create memory leaks that I know of. The first is to create objects and never release references to them (for instance, store them all in a List<T> object). The other is to use unmanaged code (ActiveX, P/Invoke, etc.) which already has a memory leak. Neither of these are generally a problem. One should still make considerations when it comes to memory management, however. References to large objects should be released as soon as possible, and IDisposable objects should be disposed as soon as possible. Even if you neglect to follow these guidelines, though, you generally have to go out of your way to create a real memory leak. Quote [sIGPIC]e[/sIGPIC]
Ginanity Posted March 14, 2007 Author Posted March 14, 2007 An important point in the design of the DotNet framework is that memory leaks are very difficult to create. There are only two ways to create memory leaks that I know of. The first is to create objects and never release references to them (for instance, store them all in a List<T> object). The other is to use unmanaged code (ActiveX, P/Invoke, etc.) which already has a memory leak. Neither of these are generally a problem. One should still make considerations when it comes to memory management, however. References to large objects should be released as soon as possible, and IDisposable objects should be disposed as soon as possible. Even if you neglect to follow these guidelines, though, you generally have to go out of your way to create a real memory leak. ok i wasn't aware of this, thx. But is it possible to get the amount of memory that is being used by the application? Quote
Leaders snarfblam Posted March 14, 2007 Leaders Posted March 14, 2007 Off the top of my head, the GC and Process classes might help. Quote [sIGPIC]e[/sIGPIC]
MrPaul Posted March 15, 2007 Posted March 15, 2007 MSDN article If you're worried about memory leaks, you may find this MSDN article useful: Debug Leaky Apps: Identify And Prevent Memory Leaks In Managed Code. Good luck :) Quote Never trouble another for what you can do for yourself.
Ginanity Posted March 15, 2007 Author Posted March 15, 2007 Off the top of my head, the GC and Process classes might help. that's just what i need, thank you for ur time and Mr Paul thx for the article. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.