weakreference bug?


[testmethod]
public vacant memory()
{
var wr = new weakreference("aaabbb");
assert.istrue(wr.isalive);
gc.collect();
gc.collect();
gc.collect();
gc.collect();
gc.collect();
assert.isfalse(wr.isalive); //<-- fails here
}


it's .net 3.5 sp1

can anyone tell me since exam fails?



edit: interjection stusmith




you have anxiety string,
given constant, is
substantially interned (ie dynamically
allocated), never be
collected.




that it. altered initial line



var wr = new weakreference(new object());


and exam passes :-)



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members