Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / September 2004

Tip: Looking for answers? Try searching our database.

Adding, removing MenuItem, does not release memory?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Giedrius - 16 Sep 2004 13:43 GMT
Well, after developing a plugin based architecture, with lots of menuitems, i
found that after adding a menuitem, and later removing, results in increased
memory.
I know all that thing with Dispose, finalizers, garbage collector, and so
on, they do not help.

'try this, to see a how fast memory grows.

dim i as int32
Dim m As New MenuItem("ok")
for i = 1 to 10000
           Me.Menu.MenuItems.Add(m)
           Windows.Forms.Application.DoEvents()
           Me.Menu.MenuItems.Remove(m)
           Me.Text = GC.GetTotalMemory(True).ToString
next

'however other controls does not leave their stuff
Dim m As New Label
dim i as int32
for i = 1 to 10000
           Me.Controls.Add(l)
           Windows.Forms.Application.DoEvents()
           Me.Controls.Remove(l)
           Me.Text = GC.GetTotalMemory(True).ToString
next
Christopher Kimbell - 16 Sep 2004 16:32 GMT
Download the latest service pack for the .NET framework.

SP3 article: http://support.microsoft.com/?kbid=867461

The following is one of the fixes:

FIX : Menu Items Leak When Added to a Menu Bar on a Windows Form:
http://support.microsoft.com/default.aspx?kbid=817723

Chris

> Well, after developing a plugin based architecture, with lots of
> menuitems, i
[quoted text clipped - 24 lines]
>            Me.Text = GC.GetTotalMemory(True).ToString
> next
Giedrius - 17 Sep 2004 08:53 GMT
yes, but I use .Net Framework 1.1

> Download the latest service pack for the .NET framework.
>
[quoted text clipped - 35 lines]
> >            Me.Text = GC.GetTotalMemory(True).ToString
> > next

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.