M
MuZZy
Hi,
Consider i have a class:
class CTest
{
public static int Counter = 0;
public CTest()
{
<...>
Counter ++;
}
public override Finalize()
{
Counter --;
<...>
}
}
I found that if creating objects of this class at some point in the winforms app, and then "nulling"
the object variables, Finalize is at some point called by GC, but value of Counter never goes down,
meaning that Counter-- never in fact occures - if i aqucuire CTest.Counter at any time from the app,
it shows the number of created objects, never decreasing as the objects get collected by GC.
Is it a normal behaviour? Are the static class variables not accessibe from Finalize method?
Thank you,
Andrey
Consider i have a class:
class CTest
{
public static int Counter = 0;
public CTest()
{
<...>
Counter ++;
}
public override Finalize()
{
Counter --;
<...>
}
}
I found that if creating objects of this class at some point in the winforms app, and then "nulling"
the object variables, Finalize is at some point called by GC, but value of Counter never goes down,
meaning that Counter-- never in fact occures - if i aqucuire CTest.Counter at any time from the app,
it shows the number of created objects, never decreasing as the objects get collected by GC.
Is it a normal behaviour? Are the static class variables not accessibe from Finalize method?
Thank you,
Andrey