title: Increasing heap space in Eclipse: (java.lang.OutOfMemoryError)
body: <pre><code>try {
      // CompareRecord record = new CompareRecord();
      Connection conn = new CompareRecord().getConection("eliteddaprd","eliteddaprd","192.168.14.104","1521");
      ResultSet res = null;
  
      if (conn != null){
          Statement stmt = conn.createStatement();
          res = stmt.executeQuery("select rowindx,ADDRLINE1 from dedupinitial order by rowindx");
      }
  
      Map&lt;Integer,String&gt; adddressMap = new LinkedHashMap&lt;Integer, String&gt;();
      if (res != null){
          System.out.println("result set is not null ");
          while(res.next()){
              adddressMap.put(res.getInt(1),res.getString(2));
          }
      }
  
      System.out.println("address Map size =========&gt; "+adddressMap.size());
      Iterator it = adddressMap.entrySet().iterator();
      int count = 0;
      int min = 0;
  
      while (it.hasNext()){
          Map.Entry pairs = (Map.Entry)it.next();
          Pattern p = Pattern.compile("[,\\s]+");
          Integer outerkey = (Integer)pairs.getKey();
          String outerValue = (String)pairs.getValue();
          //System.out.println("outer Value ======&gt; "+outerValue);
  
          String[] outerresult = p.split(outerValue);
          Map.Entry pairs2 = null;
          count++;
          List&lt;Integer&gt; dupList = new ArrayList&lt;Integer&gt;();
  
          Iterator innerit = adddressMap.entrySet().iterator();
          boolean first = true;
  
          while (innerit.hasNext()){
              //System.out.println("count value ===&gt; "+count);
              int totmatch = 0;
              if(first){
                  if(count == adddressMap.size()){
                      break;
                  }
                  for(int i=0;i&lt;=count;i++){
                      pairs2 = (Map.Entry)innerit.next();
                  }
                  first  = false;
              }
              else{
                  pairs2 = (Map.Entry)innerit.next();
              }
              Integer innterKey = (Integer)pairs2.getKey();
              String innerValue = (String)pairs2.getValue();
              //System.out.println("innrer value "+innerValue);
              String[] innerresult = p.split(innerValue);
  
              for(int j=0;j&lt;outerresult.length;j++){
                  for(int k=0;k&lt;innerresult.length;k++){
                      if(outerresult[j].equalsIgnoreCase(innerresult[k])){
                          //System.out.println(outerresult[j]+" Match With "+innerresult[k]);
                          totmatch++;
                          break;
                      }
                  }
              }
  
              min = Math.min(outerresult.length, innerresult.length);
              if(min != 0 &amp;&amp; ((totmatch*100)/min) &gt; 50) {
                  //System.out.println("maching inner key =========&gt; "+innterKey);
                  dupList.add(innterKey);
              }
          }
          //System.out.println("Duplilcate List Sisze ===================&gt; "+dupList.size()+"   "+outerkey);
      }
  
      System.out.println("End  =========&gt; "+new Date());
  }
  catch (Exception e) {
      e.printStackTrace();
  }
  </code></pre>
  
  <p>Here ResultSet have processed around 500000 records, but it will give me error like:</p>
  
  <pre><code>Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
      at java.util.HashMap.resize(HashMap.java:508)
      at java.util.LinkedHashMap.addEntry(LinkedHashMap.java:406)
      at java.util.HashMap.put(HashMap.java:431)
      at spite.CompareRecord.main(CompareRecord.java:91)
  </code></pre>
  
  <p>I know this error comes because of VM memory, but don't know how to increase it in Eclipse?</p>
  
  <p>What do I do if I have to process even more than 500,000 records?</p>