Can anyone please help me in finding out whether the below code causes memory leak or not. If it doesnt cause leak wat modification i can do to make it leak.
Thank You
Here is the code in FORM1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace custom
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
public static void call()
{
Form2 f3 = new Form2();
f3.Show();
}
private void button1_Click(object sender, EventArgs e)
{
call();
}
}
}
This is the code in FORM2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Collections;
namespace custom
{
public class mycalss
{
public void disp()
{
Form2 f2w = new Form2();
f2w.even+=new Form2.del(f2w.f2_even);
f2w.raiseeven();
}
}
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public delegate void del();
public event del even;
public void raiseeven()
{
even();
//objc.Add(f2);
}
//public ArrayList objc = new ArrayList();
public static void call1()
{
Form1 f1 = new Form1();
f1.Show();
}
public void button1_Click(object sender, EventArgs e)
{
Form2 f2 = new Form2();
mycalss my = new mycalss();
my.disp();
f2.even+=new del(f2_even);
f2.raiseeven();
//objc.Add(f2);
//call1();
}
public void f2_even()
{
call1();
}
}
}
The above code is nothing but simple button click on which it displays form1 or form2