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 (); }
/* * 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; }
/* * 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"); }
/* * 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; } }
/* * 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"); }
/* * 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"); }
/* * 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-"); }
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(); }
/* * 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"); }
/* * 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"); }
/* * 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-"); }
/* * 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-"); }
/* * 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-"); }
/* * 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; }
/* * 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; } }