What I'd like to do is wrap some suspect functions that may be leaking in a using statement to trigger garbage collection, has anyone used or seen something like this? Does this work? Whats your thoughts on this?
using (String wrapper = new String("maybe this will trigger gc")){
//do stuff here
//or maybe:
// function1();
// function2();
//
//and then see if its leaking?
// eg:
_mygeometry = new Geometry();
_mygeometry = null; // will GC free this ?
}
Do you think this will work? Have you used this before? Is there something I can do that isnt a String? Im using WPF, I tried using ( var garbage = 1 ){} and doesnt work, I suppose String might though.