System.GC.Collect

Here are the examples of the python api System.GC.Collect taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

2 Examples 7

Example 1

Project: ironpython3 Source File: assert_util.py
Function: get_total_memory
    def GetTotalMemory():
        import System
        # 3 collect calls to ensure collection
        for x in range(3):
            System.GC.Collect()
            System.GC.WaitForPendingFinalizers()
        return System.GC.GetTotalMemory(True)

Example 2

Project: ironpython3 Source File: assert_util.py
Function: force_gc
def force_gc():
    if is_silverlight:
        return
    elif is_cpython:
        import gc
        gc.collect()
    else:
        import System
        for i in range(100):
            System.GC.Collect()
        System.GC.WaitForPendingFinalizers()