title: Memory leak when using array list
body: <p>I am executing the below program and storing the value in-memory object, but GC is not able to clear the object memory resulting in the out of memory exception </p>
  
  <p>Kindly assist with your insight </p>
  
  <pre><code>package sampletest;
  
  import java.text.ParseException;
  import java.text.SimpleDateFormat;
  import java.util.ArrayList;
  import java.util.List;
  
  public class studentDB
  {
    public static List&lt;Student&gt; retrieve()
      throws ParseException
    {
      List&lt;Student&gt; students = new ArrayList();
      for (int i = 0; i &lt; 100000; i++)
      {
        Student student = new Student();
        student.setAge(new Integer(i));
        student.setBirthDate(new SimpleDateFormat("ddMMyyyy").parse("01061986"));
        student.setName("Student" + new String(new Integer(i).toString()));
        students.add(student);
      }
      return students;
  </code></pre>
  
  <p>thanks in advance </p>