Activity overview
Latest activity by sandyp
Yes, it looks strange but your findings explain everything. Thanks! / comments
Yes, it looks strange but your findings explain everything. Thanks!
I have the same situation. The very simple WinForms test: public class MyInfoClass
{
string _name = String.Empty;
public MyInfoClass(string name)
{
_name = name;
}
public string Name
{
get
{
return _name;
}
set
{
_name = value;
}
}
}
public partial class Form1 : Form
{
private List<MyInfoClass> _list = null;
public Form1()
{
InitializeComponent();
List<MyInfoClass> list = new List<MyInfoClass>();
list.Add(new MyInfoClass("1"));
list.Add(new MyInfoClass("2"));
list.Add(new MyInfoClass("3"));
_list = list;
}
private void button1_Click(object sender, EventArgs e)
{
_list = null;
}
private void button2_Click(object sender, EventArgs e)
{
_list.Clear();
_list = null;
GC.Collect();
}
}
After pressing button2, I have [GC Handle]->System.Object[]->MyInfoClass[] chain and it's remained in memory after new snapshots. Any ideas why? / comments
I have the same situation. The very simple WinForms test:public class MyInfoClass
{
string _name = String.Empty;
public MyInfoClass(string name)
{
...