Garbage Collector Question

Hi guys,

What if something like this occurs:

myObject=new MyObject();
//do some stuff with it then free the memory
delete(myObject);

// hopefully the Garbage Collector ran a sweep but what if it didn’t ?

// now I need it again
myObject=new MyObject();

I run into that scenario a lot.

Thanks.