A
atsmith6
Hi all
I'm trying to better understand the behanviour of garbage collection
in .NET 2.0 and was wondering if anyone could shed some light on the
following:
If I have code something like
private void MyMethod(MyObj obj)
{
// Do something with obj
}
private void OtherMethod()
{
MyMethod(new MyObj);
// perhaps more code here
}
Assuming MyMethod uses the object, where is the point (I'm thinking in
terms of the equivalent to sequence points in the C++ language) at
which the object will be flagged for garbage collection? Is the above
code safe?
Many thanks in advance to anyone who may know the answer and reply.
Any references to MSDN pages would also be considered an added bonus
and very much appreciated.
Kind Regards
Anthony Smith
I'm trying to better understand the behanviour of garbage collection
in .NET 2.0 and was wondering if anyone could shed some light on the
following:
If I have code something like
private void MyMethod(MyObj obj)
{
// Do something with obj
}
private void OtherMethod()
{
MyMethod(new MyObj);
// perhaps more code here
}
Assuming MyMethod uses the object, where is the point (I'm thinking in
terms of the equivalent to sequence points in the C++ language) at
which the object will be flagged for garbage collection? Is the above
code safe?
Many thanks in advance to anyone who may know the answer and reply.
Any references to MSDN pages would also be considered an added bonus
and very much appreciated.
Kind Regards
Anthony Smith