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 / .NET Framework / Performance / May 2007

Tip: Looking for answers? Try searching our database.

Memory Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
javiers - 24 May 2007 13:57 GMT
My VB.NET application is having a memory problem. It consist in a menu
form (mform) which calls other forms (oform). Actually, the mform
doesn't call the oform directly, it creates a new thread where the
oform is created and called. When the oform is closed its thread is
set to nothing, but the oform's memory remains.

I'm using MemProfiler in order to know which objects are allocated in
memory. I've also used perfmon invoking the GC and I can see that the
memory keeps increasing. I thought that when the thread, which has
created the oform, is released the oform would be released too. But my
app don't behave like that.

Is it posible to create a thread that when is finished disposes all
its objects? What could be happening to my app?

Thanks in advance.
Mattias Sjögren - 24 May 2007 17:38 GMT
>Is it posible to create a thread that when is finished disposes all
>its objects?

Not automatically, no. There's no such connection between an object
and the thread it was created on.

Winforms keeps its form objects alive as long as the window is open.
Have you closed the window?

Mattias

Signature

Mattias Sjögren [C# MVP]  mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.

javiers - 24 May 2007 17:49 GMT
Yes, I've closed the windows and set it to nothing. I can see also
that the dispose method is correctly called.

On 24 mayo, 13:38, Mattias Sj?gren <mattias.dont.want.s...@mvps.org>
wrote:
> >Is it posible to create a thread that when is finished disposes all
> >its objects?
[quoted text clipped - 10 lines]
> Mattias Sj?gren [C# MVP]  mattias @ mvps.orghttp://www.msjogren.net/dotnet/|http://www.dotnetinterop.com
> Please reply only to the newsgroup.
Alvin Bruney [MVP] - 29 May 2007 03:10 GMT
> form (mform) which calls other forms (oform). Actually, the mform
> doesn't call the oform directly,
Right. It can't.

>it creates a new thread where the
> oform is created and called.
I don't understand what that means how this is possible. You'll need to
explain this some more.

>When the oform is closed its thread is
> set to nothing, but the oform's memory remains.
It's got a root. That's the long and short of it. First let's deal with your
design, fixing the leak should be easy after the design is explained.

Signature

Regards,
Alvin Bruney
------------------------------------------------------
Shameless author plug
Excel Services for .NET is coming...
https://www.microsoft.com/MSPress/books/10933.aspx
OWC Black Book www.lulu.com/owc
Professional VSTO 2005 - Wrox/Wiley

> My VB.NET application is having a memory problem. It consist in a menu
> form (mform) which calls other forms (oform). Actually, the mform
[quoted text clipped - 11 lines]
>
> Thanks in advance.

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.