Explain how the garbage collection mechanism in C# handles cyclic references. What impact do weak references and the IDisposable pattern have in such a scenario, and how could you use both to mitigate potential memory leaks caused by cyclic dependencies? Provide code examples to illustrate your explanation.
IDisposable
Context to Consider: