I found what seems to be an easy and effective way to reduce the memory consumption of my vb.net app. What I need to know is how "correct" or "proper" is the method I'm using for my application and what exactly is going on behind the scenes that I should worry about? I want to release memory every time a form closes. Here is how I reduce the required memory of my program:
I am simply applying the existing values, and this seems to force the framework to effectively "trim" my application memory (significantly). All my program does is display a few forms with some buttons and thats it. Would it be ok to make the above calls all the time (for example every time I close the form) so memory actually gets released to the system? I'm asking if it's OK to do this, not if anyone suggests that I should leave it alone and let the GC and VMM do their job. They do a great job, for programs that have potential of using more RAM. Mine will not and I therefore want to keep the footprint absolutely minimal, and the above method works great. I just need to know if I am safe to make those calls all the time. Thanks in advance.
VB.NET:
[SIZE=2]Process.GetCurrentProcess.MinWorkingSet = Process.GetCurrentProcess.MinWorkingSet[/SIZE]
[SIZE=2]Process.GetCurrentProcess.MaxWorkingSet = Process.GetCurrentProcess.MaxWorkingSet[/SIZE]
I am simply applying the existing values, and this seems to force the framework to effectively "trim" my application memory (significantly). All my program does is display a few forms with some buttons and thats it. Would it be ok to make the above calls all the time (for example every time I close the form) so memory actually gets released to the system? I'm asking if it's OK to do this, not if anyone suggests that I should leave it alone and let the GC and VMM do their job. They do a great job, for programs that have potential of using more RAM. Mine will not and I therefore want to keep the footprint absolutely minimal, and the above method works great. I just need to know if I am safe to make those calls all the time. Thanks in advance.
Last edited: