|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Visual Basic App Memory IssueI have written a small app to monitor several running processes and everything is fine except the memory usage. When the app starts up, even though there is very little on the form, the memory usage displayed in task manager jumps to 24MB. If I minimize the app, usage drops to .6MB. If I then restore the app, it moves back up to 3-6MB. Here are a few details about the program: 1. There is a custom control in a separate dll that does the real work. Each instance of the control monitors 1 app. It takes a small bit of XML in the form of an XmlElement for initialization. It contains 4 16x16 32bit images, 3 buttons, 2 labels, a tooltip, and a subform for configuration. 2. The custom controls are stored on a custom tabpage that controls positioning and size. This tabpage raises a few events that affect the size of the main form and the form icon. 3. The main form has 4 icons stored in an array and 4 images are stored in an image list for the tab pages, a menu with 8 entries, and a tab control. 4. By default, and without an XML file to load from, there are no custom tab pages or controls loaded, yet the memory issue still occurs. 5. Up until the main form is shown (Form.Show()) and minimized (Form.WindowState = FormWindowState.Minimized), the memor usage is between 24 and 30 MB. Once the form is shown and minimized by hand, the usage drops to 600k. While testing, I wrapped the app in a module that immediately showed and minimized the form. Doing this programmatically, the memory usage dropped to 5MB. Is there anything I can do to reduce the memory footprint of this app? ignore it, thats just the way JIT compilers work with Garbage collection...
the memory system you see in task manager doesn't know how to correctly display memory usage in a .NET app so you get large ammounts of "allocated" memory that isn't even in use by the app showing up.. <bamapoo***@gmail.com> wrote in message Show quoteHide quote news:1112815821.761943.15320@z14g2000cwz.googlegroups.com... >I am new to VB, but not new to programming. I am using VB.Net 2003 and > I have written a small app to monitor several running processes and > everything is fine except the memory usage. When the app starts up, > even though there is very little on the form, the memory usage > displayed in task manager jumps to 24MB. > If I minimize the app, usage drops to .6MB. If I then restore the app, > it moves back up to 3-6MB. > > Here are a few details about the program: > > 1. There is a custom control in a separate dll that does the real work. > Each instance of the control monitors 1 app. It takes a small bit of > XML in the form of an XmlElement for initialization. It contains 4 > 16x16 32bit images, 3 buttons, 2 labels, a tooltip, and a subform for > configuration. > 2. The custom controls are stored on a custom tabpage that controls > positioning and size. This tabpage raises a few events that affect the > size of the main form and the form icon. > 3. The main form has 4 icons stored in an array and 4 images are stored > in an image list for the tab pages, a menu with 8 entries, and a tab > control. > 4. By default, and without an XML file to load from, there are no > custom tab pages or controls loaded, yet the memory issue still occurs. > 5. Up until the main form is shown (Form.Show()) and minimized > (Form.WindowState = FormWindowState.Minimized), the memor usage is > between 24 and 30 MB. Once the form is shown and minimized by hand, > the usage drops to 600k. While testing, I wrapped the app in a module > that immediately showed and minimized the form. Doing this > programmatically, the memory usage dropped to 5MB. > > Is there anything I can do to reduce the memory footprint of this app? > <bamapoo***@gmail.com> schrieb:
>I am new to VB, but not new to programming. I am using VB.Net 2003 and The behavior caused by minimizing a form is not specific to .NET> I have written a small app to monitor several running processes and > everything is fine except the memory usage. When the app starts up, > even though there is very little on the form, the memory usage > displayed in task manager jumps to 24MB. > If I minimize the app, usage drops to .6MB. If I then restore the app, > it moves back up to 3-6MB. applications only. It is a feature of the Windows/Explorer shell. If an application is minimized, Windows removes the working set memory from the application by calling the Win32 function 'SetProcessWorkingSetSize': <URL:http://msdn.microsoft.com/library/en-us/dllproc/base/setprocessworkingsetsize.asp> Windows supposes that minimized applications will not be used for some time and this memory will be made available to other processes. When restoring the window the application gets the memory back: PRB: An Application's Working Set Is Trimmed When Its Top-Level Window Is Minimized <URL:http://support.microsoft.com/?scid=kb;EN-US;293215> This behavior is by design and it doesn't make sense to worry about it. The Memory Mystery <URL:http://getdotnetco.web101.discountasp.net/GdncStore/free/Articles/The%20Memory%20Mystery.htm> Allocation Profiler src <URL:http://www.gotdotnet.com/Community/UserSamples/Details.aspx?SampleGuid=3254325d-a4aa-4bb3-aa86-c72d5104ec74> -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/>
Please do NOT sign the VB.COM petition
What am I doing wrong - Trying to update Option Strict disallows late binding, need to update code Set textbox1.enabled = false inside a module? How to create a zoom feature in Vb.Net Passing objects ByVal vs ByRef Invert an Arraylist.Sort() SharpZipLib Icons in a class library Excel In VB.net |
|||||||||||||||||||||||