コード例 #1
0
	static void CrashMainLoop () {
		var arr = new object [major_fill];
		for (int i = 0; i < major_fill; ++i)
			arr [i] = new NonBridge ();
		GC.Collect (1);
		Console.WriteLine ("major fill done");

		//induce massive fragmentation
		for (int i = 0; i < major_fill; i += 4) {
			arr [i + 1] = null;
			arr [i + 2] = null;
			arr [i + 3] = null;
		}
		GC.Collect (1);
		Console.WriteLine ("fragmentation done");

		//since 50% is garbage, do 2 fill passes
		for (int j = 0; j < 2; ++j) {
			for (int i = 0; i < major_fill; ++i) {
				if ((i % 1000) == 0)
					new Bridge ();
				else
					arr [i] = new Bridge ();
			}
		}
		Console.WriteLine ("done spewing bridges");
		
		for (int i = 0; i < major_fill; ++i)
			arr [i] = null;
		GC.Collect ();
	}
コード例 #2
0
    /*
     * Triggered a bug in the forwarding mechanic.
     */
    static void SetupSelfLinks()
    {
        var head = new Bridge();
        var tail = new NonBridge();

        head.Links.Add(tail);
        tail.Link = tail;
    }
コード例 #3
0
ファイル: GcBridge.cs プロジェクト: liuwjchinal/benchmarker
        /*
         * Triggered a bug in the forwarding mechanic.
         * This is a functional test, not a performance test, so Tests.cs does not include it.
         */
        static void SetupSelfLinks()
        {
            var head = new Bridge();
            var tail = new NonBridge();

            head.Links.Add(tail);
            tail.Link = tail;
            logger.Info("GC bridge: \"self links\" setup done");
        }
コード例 #4
0
    /*
     * Not necessarily a pathology, but a special case of where we
     * generate lots of "dead" SCCs.  A non-bridge object that
     * can't reach a bridge object can safely be removed from the
     * graph.  In this special case it's a linked list hanging off
     * a bridge object.  We can handle this by "forwarding" edges
     * going to non-bridge nodes that have only a single outgoing
     * edge.  That collapses the whole list into a single node.
     * We could remove that node, too, by removing non-bridge
     * nodes with no outgoing edges.
     */
    static void SetupDeadList()
    {
        var head = new Bridge();
        var tail = new NonBridge();

        head.Links.Add(tail);
        for (int i = 0; i < LIST_LENGTH; ++i)
        {
            var obj = new NonBridge();
            tail.Link = obj;
            tail      = obj;
        }
    }
コード例 #5
0
ファイル: GcBridge.cs プロジェクト: liuwjchinal/benchmarker
        /*
         * Not necessarily a pathology, but a special case of where we
         * generate lots of "dead" SCCs.  A non-bridge object that
         * can't reach a bridge object can safely be removed from the
         * graph.  In this special case it's a linked list hanging off
         * a bridge object.  We can handle this by "forwarding" edges
         * going to non-bridge nodes that have only a single outgoing
         * edge.  That collapses the whole list into a single node.
         * We could remove that node, too, by removing non-bridge
         * nodes with no outgoing edges.
         */
        static void SetupDeadList()
        {
            var head = new Bridge();
            var tail = new NonBridge();

            head.Links.Add(tail);
            for (int i = 0; i < LIST_LENGTH; ++i)
            {
                var obj = new NonBridge();
                tail.Link = obj;
                tail      = obj;
            }
            logger.Info("GC bridge: \"deadlist\" setup done");
        }
コード例 #6
0
ファイル: GcBridge.cs プロジェクト: xamarin/benchmarker
		/*
		 * Pathological case for the new algorithm.  Goes away with
		 * the single-node elimination optimization, but will still
		 * persist if modified by using a ladder instead of the single
		 * list.
		 */
		static void SetupLinkedFan()
		{
			var head = new Bridge();
			var tail = new NonBridge();
			head.Links.Add(tail);
			for (int i = 0; i < LIST_LENGTH; ++i)
			{
				var obj = new NonBridge();
				tail.Link = obj;
				tail = obj;
			}
			var list = new List<Bridge>();
			tail.Link = list;
			for (int i = 0; i < FAN_OUT; ++i)
				list.Add(new Bridge());
			logger.Info("GC bridge: \"linked fan\" setup done");
		}
コード例 #7
0
	/*
	 * Pathological case for the new algorithm.  Goes away with
	 * the single-node elimination optimization, but will still
	 * persist if modified by using a ladder instead of the single
	 * list.
	 */
	static void SetupLinkedFan ()
	{
		var head = new Bridge ();
		var tail = new NonBridge ();
		head.Links.Add (tail);
		for (int i = 0; i < LIST_LENGTH; ++i)
		{
			var obj = new NonBridge ();
			tail.Link = obj;
			tail = obj;
		}
		var list = new List<Bridge> ();
		tail.Link = list;
		for (int i = 0; i < FAN_OUT; ++i)
			list.Add (new Bridge ());
		Console.WriteLine ("-linked fan done-");
	}
コード例 #8
0
    static void CrashMainLoop()
    {
        var arr = new object [major_fill];

        for (int i = 0; i < major_fill; ++i)
        {
            arr [i] = new NonBridge();
        }
        GC.Collect(1);
        LogLine("major fill done");

        //induce massive fragmentation
        for (int i = 0; i < major_fill; i += 4)
        {
            arr [i + 1] = null;
            arr [i + 2] = null;
            arr [i + 3] = null;
        }
        GC.Collect(1);
        LogLine("fragmentation done");

        //since 50% is garbage, do 2 fill passes
        for (int j = 0; j < 2; ++j)
        {
            for (int i = 0; i < major_fill; ++i)
            {
                if ((i % 1000) == 0)
                {
                    new Bridge();
                }
                else
                {
                    arr [i] = new Bridge();
                }
            }
        }
        LogLine("done spewing bridges");

        for (int i = 0; i < major_fill; ++i)
        {
            arr [i] = null;
        }
        GC.Collect();
    }
コード例 #9
0
ファイル: GcBridge.cs プロジェクト: liuwjchinal/benchmarker
        /*
         * Pathological case for the new algorithm.  Goes away with
         * the single-node elimination optimization, but will still
         * persist if modified by using a ladder instead of the single
         * list.
         */
        static void SetupLinkedFan()
        {
            var head = new Bridge();
            var tail = new NonBridge();

            head.Links.Add(tail);
            for (int i = 0; i < LIST_LENGTH; ++i)
            {
                var obj = new NonBridge();
                tail.Link = obj;
                tail      = obj;
            }
            var list = new List <Bridge>();

            tail.Link = list;
            for (int i = 0; i < FAN_OUT; ++i)
            {
                list.Add(new Bridge());
            }
            logger.Info("GC bridge: \"linked fan\" setup done");
        }
コード例 #10
0
ファイル: GcBridge.cs プロジェクト: liuwjchinal/benchmarker
        /*
         * Pathological case for the improved old algorithm.  Goes
         * away with copy-on-write DynArrays, but will still persist
         * if modified by using a ladder instead of the single list.
         */
        static void SetupInverseFan()
        {
            var    tail = new Bridge();
            object list = tail;

            for (int i = 0; i < LIST_LENGTH; ++i)
            {
                var obj = new NonBridge();
                obj.Link = list;
                list     = obj;
            }
            var heads = new Bridge[FAN_OUT];

            for (int i = 0; i < FAN_OUT; ++i)
            {
                var obj = new Bridge();
                obj.Links.Add(list);
                heads[i] = obj;
            }
            logger.Info("GC bridge: \"inverse fan\" setup done");
        }
コード例 #11
0
    /*
     * Pathological case for the improved old algorithm.  Goes
     * away with copy-on-write DynArrays, but will still persist
     * if modified by using a ladder instead of the single list.
     */
    static void SetupInverseFan()
    {
        var    tail = new Bridge();
        object list = tail;

        for (int i = 0; i < LIST_LENGTH; ++i)
        {
            var obj = new NonBridge();
            obj.Link = list;
            list     = obj;
        }
        var heads = new Bridge [FAN_OUT];

        for (int i = 0; i < FAN_OUT; ++i)
        {
            var obj = new Bridge();
            obj.Links.Add(list);
            heads [i] = obj;
        }
        Console.WriteLine("-inverse fan done-");
    }
コード例 #12
0
    /*
     * Pathological case for the new algorithm.  Goes away with
     * the single-node elimination optimization, but will still
     * persist if modified by using a ladder instead of the single
     * list.
     */
    static void SetupLinkedFan()
    {
        var head = new Bridge();
        var tail = new NonBridge();

        head.Links.Add(tail);
        for (int i = 0; i < LIST_LENGTH; ++i)
        {
            var obj = new NonBridge();
            tail.Link = obj;
            tail      = obj;
        }
        var list = new List <Bridge> ();

        tail.Link = list;
        for (int i = 0; i < FAN_OUT; ++i)
        {
            list.Add(new Bridge());
        }
        Console.WriteLine("-linked fan done-");
    }
コード例 #13
0
	/*
	 * Pathological case for the improved old algorithm.  Goes
	 * away with copy-on-write DynArrays, but will still persist
	 * if modified by using a ladder instead of the single list.
	 */
	static void SetupInverseFan ()
	{
		var tail = new Bridge ();
		object list = tail;
		for (int i = 0; i < LIST_LENGTH; ++i)
		{
			var obj = new NonBridge ();
			obj.Link = list;
			list = obj;
		}
		var heads = new Bridge [FAN_OUT];
		for (int i = 0; i < FAN_OUT; ++i)
		{
			var obj = new Bridge ();
			obj.Links.Add (list);
			heads [i] = obj;
		}
		Console.WriteLine ("-inverse fan done-");
	}
コード例 #14
0
ファイル: GcBridge.cs プロジェクト: xamarin/benchmarker
		/*
		 * Not necessarily a pathology, but a special case of where we
		 * generate lots of "dead" SCCs.  A non-bridge object that
		 * can't reach a bridge object can safely be removed from the
		 * graph.  In this special case it's a linked list hanging off
		 * a bridge object.  We can handle this by "forwarding" edges
		 * going to non-bridge nodes that have only a single outgoing
		 * edge.  That collapses the whole list into a single node.
		 * We could remove that node, too, by removing non-bridge
		 * nodes with no outgoing edges.
		 */
		static void SetupDeadList()
		{
			var head = new Bridge();
			var tail = new NonBridge();
			head.Links.Add(tail);
			for (int i = 0; i < LIST_LENGTH; ++i)
			{
				var obj = new NonBridge();
				tail.Link = obj;
				tail = obj;
			}
			logger.Info("GC bridge: \"deadlist\" setup done");
		}
コード例 #15
0
	/*
	 * Triggered a bug in the forwarding mechanic.
	 */
	static void SetupSelfLinks ()
	{
		var head = new Bridge ();
		var tail = new NonBridge ();
		head.Links.Add (tail);
		tail.Link = tail;
	}
コード例 #16
0
	/*
	 * Not necessarily a pathology, but a special case of where we
	 * generate lots of "dead" SCCs.  A non-bridge object that
	 * can't reach a bridge object can safely be removed from the
	 * graph.  In this special case it's a linked list hanging off
	 * a bridge object.  We can handle this by "forwarding" edges
	 * going to non-bridge nodes that have only a single outgoing
	 * edge.  That collapses the whole list into a single node.
	 * We could remove that node, too, by removing non-bridge
	 * nodes with no outgoing edges.
	 */
	static void SetupDeadList ()
	{
		var head = new Bridge ();
		var tail = new NonBridge ();
		head.Links.Add (tail);
		for (int i = 0; i < LIST_LENGTH; ++i)
		{
			var obj = new NonBridge ();
			tail.Link = obj;
			tail = obj;
		}
	}
コード例 #17
0
ファイル: GcBridge.cs プロジェクト: xamarin/benchmarker
		/*
		 * Triggered a bug in the forwarding mechanic.
		 * This is a functional test, not a performance test, so Tests.cs does not include it.
		 */
		static void SetupSelfLinks()
		{
			var head = new Bridge();
			var tail = new NonBridge();
			head.Links.Add(tail);
			tail.Link = tail;
			logger.Info("GC bridge: \"self links\" setup done");
		}
コード例 #18
0
ファイル: GcBridge.cs プロジェクト: xamarin/benchmarker
		/*
		 * Pathological case for the improved old algorithm.  Goes
		 * away with copy-on-write DynArrays, but will still persist
		 * if modified by using a ladder instead of the single list.
		 */
		static void SetupInverseFan()
		{
			var tail = new Bridge();
			object list = tail;
			for (int i = 0; i < LIST_LENGTH; ++i)
			{
				var obj = new NonBridge();
				obj.Link = list;
				list = obj;
			}
			var heads = new Bridge[FAN_OUT];
			for (int i = 0; i < FAN_OUT; ++i)
			{
				var obj = new Bridge();
				obj.Links.Add(list);
				heads[i] = obj;
			}
			logger.Info("GC bridge: \"inverse fan\" setup done");
		}