如果我宣布一个静态的队列这样的公共类中:这会造成内存泄漏吗?
public class c
{
private string[] s={"a","b","c"};
private static Queue<string> q = new Queue<string>(s);
static private void SomeMethod()
{
private string[] s2 = {"123","345"};
// somewhere in here I reassign the queue q = new Queue<string>(s2);
}
}
我的行为导致C#中的内存泄漏?垃圾回收会追回可能未使用的内存吗?