Authorization
To be allowed to write messages, you need to login.
Login:
Password: 
New user?
Discussion Group
>>home >>forum list >>thread list

  Forum list | Thread list | 
  Keywords:         
Thread: Memory Leak article discussion
Author: Dmitry Belikov
Status: developer
Date: 2/14/2004 11:11:20 AM
Please put your comments on Memory Leak in Framework 1.1 article here.
Author: Dmitry Belikov
Status: developer
Date: 3/9/2004 10:55:53 AM
Two persons independently said me that the primary problem somehow regards to STA. If you remove

[STAThread]
static void Main(string[] args)



attribute, there will be no problems.
Also this problem sometimes occurs when you work with SQL server in STA.
Author: fyodor
Status: guest
Date: 3/9/2004 7:20:53 PM
The call to GC.Collect after initializing Remoting have solved this problem for me.


[STAThread]
public static void Main()
{
System.Runtime.Remoting.RemotingConfiguration.Configure (
System.Reflection.Assembly.GetExecutingAssembly().Location + ".config" );

GC.Collect();
GC.WaitForPendingFinalizers();

Author: Dmitry Belikov
Status: developer
Date: 3/16/2004 12:26:32 PM
Ok, I'll check it out!
If it helps, I will update the article. Thank you!
Author: dugalh
Status: customer
Date: 2/25/2005 8:49:55 PM
I have rewritten your test programs in C++, using the STA model. I do not see the memory leak - all objects are finalised. I am using the framework 1.1 service pack 1. Do you know if the service pack fixes the problem or is there some difference between C++ and C# (I only have the C++ IDE)?
Author: Dmitry Belikov
Status: developer
Date: 3/17/2005 2:19:14 PM
Sorry for a long pause, didn't notice the message.

Frankly speaking, I have no idea why it works. Probably, there is some difference between implementations. The core reason is that Garbage Collector works only in the main STA thread (in order to execute objects' destructors in the main thread). If you make an invocation that goes to WinAPI and doesn't return, all objects created in other threads cannot be collected.
Author: koltti
Status: guest
Date: 11/10/2005 5:47:47 PM
I dont see difference when I drive that sample with line RemotingConfiguration.Configure("Server.exe.config"); and without it.
In both cases destructor of the aClass never called until server process is goining down.
Author: Michael Hersonsky
Status: developer
Date: 11/14/2005 4:39:12 PM
Please refer to this page (http://groups.google.com/group/microsoft.public.dotnet.framework.clr/browse_thread/thread/7740b1d7afcd3b7e/90e2812cf55da065?lnk=st&q=stathread+mtathread+garbage+group:microsoft.*&rnum=3&hl=en#90e2812cf55da065) for more details about STAThread influence on Garbage Collection.
Author: Beppler
Status: guest
Date: 1/27/2006 1:14:37 AM
I did not see any difference too, the "Called!" string is only showed if I change the [STAThread] to [MTAThread]
Author: Michael Hersonsky
Status: developer
Date: 1/31/2006 6:56:25 PM
Please use the above mentioned Google Groups link to find more details about STAThread influence on Garbage Collection.
Author: hulinning
Status: guest
Date: 5/8/2006 11:06:48 PM
I try to run MS 101 VB.NET sample code using tcp mode. I got no memory leak at all in the server after creating million of objects containing large memory usage (1mega bytes) created inside the class. The memory usage is go up and down as I expected that GC picks up unused objects and delete them.

I wonder if the statement from Dmitry Belikov only true if you create remoting lirary with Genuinechannels.

Does any got a problem in creating Remoting library using VB.NET 1.1 in VS 2003, and using Remote configuration file to load your setting.

Thanks
Author: rogerrong
Status: guest
Date: 3/21/2007 2:43:23 AM
Any one knows whether this memory leak problem still exists in .Net 2.0?
Author: Dmitry Belikov
Status: developer
Date: 5/2/2007 11:13:06 AM
Yes, it still exists.
  
   Home |  Info |  Purchase |  Downloads |  Support |  Community |  Contact Us
      Copyright © 2002-2010 Genrix Software, Inc. All rights reserved.