M
Mrinal Kamboj
Hi ,
Some time back i had posted question regarding usage of GC.collect and
GC.WaitForPendingfinalizers calls , for which i had got appropriate num.
of convincing answers .
Now there's another point of contention , which as the subject explains
making such calls from a STA / MTA thread .
As per the developer i was talking to , these calls are kind of
important for STA threads , since for them GC thread can't enter the
apartment for cleansing , however for an MTA thread apartment , this is
not the case as GC can enter the apartment , but frankly saying it's
sounds crazy to me , since as per this logic :
1. There's no way GC can clean the memory allocated to STA thread
objects , since even these calls leads to GC thread invocation and i
think there n number of STA applications in the real world , which is
the default .
2. Also , even it's an STA memory allocated will be ultimately on heap
and Geno -> Gen1 -> Gen2 for .net , so this whole concept of entering
/interfering with an apartment doesn't comes in .
3. One more thing if for a given code executed on a thread and finalizer
is implemented , then while GC carries out finalization process , does
it need to enter the thread apertment , as in that case again STA thread
will be dealing with same issue .
I think i am able to somewhat convey the issue , i am facing , in case u
need more explanation / details , let me know that .
Any pointers / help would be great .
thanks ,
Mrinal
Some time back i had posted question regarding usage of GC.collect and
GC.WaitForPendingfinalizers calls , for which i had got appropriate num.
of convincing answers .
Now there's another point of contention , which as the subject explains
making such calls from a STA / MTA thread .
As per the developer i was talking to , these calls are kind of
important for STA threads , since for them GC thread can't enter the
apartment for cleansing , however for an MTA thread apartment , this is
not the case as GC can enter the apartment , but frankly saying it's
sounds crazy to me , since as per this logic :
1. There's no way GC can clean the memory allocated to STA thread
objects , since even these calls leads to GC thread invocation and i
think there n number of STA applications in the real world , which is
the default .
2. Also , even it's an STA memory allocated will be ultimately on heap
and Geno -> Gen1 -> Gen2 for .net , so this whole concept of entering
/interfering with an apartment doesn't comes in .
3. One more thing if for a given code executed on a thread and finalizer
is implemented , then while GC carries out finalization process , does
it need to enter the thread apertment , as in that case again STA thread
will be dealing with same issue .
I think i am able to somewhat convey the issue , i am facing , in case u
need more explanation / details , let me know that .
Any pointers / help would be great .
thanks ,
Mrinal