You can trigger GC from VM code by calling g_pGCHeap->GarbageCollect(generation). Look 
at GCInterface::CollectGeneration in vm\comutilnative.cpp for example 
(http://dotnet.di.unipi.it/Content/sscli/docs/doxygen/clr/vm/comutilnative_8cpp-source.html).
 You should be in cooperative GC mode to call it. You can use 
BEGIN_ENSURE_COOPERATIVE_GC/END_ENSURE_COOPERATIVE_GC to get into the cooperative GC 
mode if you are not sure... .
 
THROWSCOMPLUSEXCEPTION is just marker saying that the function throws exceptions. It 
does not throw any exceptions.
 
The OOM exception is thrown by Alloc called from FastAllocateObject.
 
-Jan

________________________________

Od: Discussion of the Rotor Shared Source CLI implementation za uživatele Gajah Mada
Odesláno: so 9/11/2004 6:09 odp.
Komu: [EMAIL PROTECTED]
Předmět: [DOTNET-ROTOR] Triggering GC



The garbage collector is triggered by resource scarcity or by programmatic
invocation in the application source code.

Is it possible to trigger the GC from the VM code? Any special
precautions/steps to do that?

In 'gcscan.cpp', it says that FastAllocateObject will throw
OutOfMemoryException. Is the exception thrown by the
THROWSCOMPLUSEXCEPTION() line? If yes, why that line is right at the
beginning of the function? Is it a  macro?


Gajah Mada

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com
ASP.NET courses you may be interested in:

Guerrilla.NET Sept 27-Oct 1, in Torrance
http://www.develop.com/courses/gdotnetls

Essential.NET Sept 20-24, in San Francisco
Essential.NET Oct. 4-8, in London
http://www.develop.com/courses/edotnet


View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorŽ  http://www.develop.com
ASP.NET courses you may be interested in:

Guerrilla.NET Sept 27-Oct 1, in Torrance
http://www.develop.com/courses/gdotnetls

Essential.NET Sept 20-24, in San Francisco
Essential.NET Oct. 4-8, in London
http://www.develop.com/courses/edotnet


View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to