title: java.lang.outofmemoryerror with firebase update
body: <p>I am developing a java <code>spring</code> application to parse a <code>file</code> about 220 Mb size  having 800 000 records. Purpose of the code is to push records into firebase database.
  The problem I am facing is </p>
  
  <blockquote>
    <p>java.lang.outofmemoryerror gc overhead limit exceeded</p>
  </blockquote>
  
  <p>This code will run fine for the first one or two times but subsequent calls will get slower and leads to out of memory error. This code snippet will work fine without firebase db update call. It has been observed the firebase db update call is not releasing the heap space even after it completes the execution.</p>
  
  <pre><code>fireDBRef = FirebaseDatabase.getInstance(FirebaseApp.getApps().get(0)).getReference(getEnvironment().getProperty(catalog_root_node));
  BeanReader reader = getBeanReader("C:\\Users\\aneesh\\Desktop\\Feeds\\N01.S2.SWC.MGS2410.BAS.ATG");
  CatalogDTO catalog = null;
  int count = 0;
  int clubNo = 0;
  String clubItemRoot = "";
  int currentSize = 0;
  Map&lt;String, Object&gt; itemjason =  new HashMap&lt;String, Object&gt;();
  int batchsize= Integer.parseInt(getEnvironment().getProperty(catalog_batch_size)) * Integer.parseInt(getEnvironment().getProperty(catalog_record_size));
  
  while((catalog = (CatalogDTO) reader.read()) != null){
      if(null==itemjason){
          itemjason =  new HashMap&lt;String, Object&gt;();
      }
      if(!getFeedValidateManger().getFeedValidator(catalog_feed_type).isValidFeed(catalog)){
          logger.info("Catalog : Invalid Feed record format : "+ Integer.parseInt(catFeedArray[3]));
          continue;
      }
      clubNo = Integer.parseInt(catalog.getClubNo());
      clubItemRoot= clubNo+getEnvironment().getProperty(items_root_node)+catalog.getItemNo();
      getItemJsonPopertiesMap(itemjason,catalog,clubItemRoot);
      currentSize = itemjason.size();
      if(itemjason!=null &amp;&amp; !itemjason.isEmpty() &amp;&amp; currentSize&gt;=batchsize)
      {
          fireDBRef.updateChildrenAsync(itemjason);
      }
      System.out.println(count++);
  }
  if(null!=itemjason &amp;&amp; itemjason.size()&lt;batchsize &amp;&amp; itemjason.size()&gt;0)
  {
      firebaseService.updateFeedsToFirebase(fireDBRef, itemjason);
      itemjason = null;
  }
  logger.info(lineNum + " lines of catalog feeds written");
  updateTracker(FeedInfoStatus.SUCCESS, "Sent records: " + getSuccessCount());
  sendNotification();
  
  } 
  catch (Exception e) {
      logger.error(e.getMessage());
      String msg = e.getMessage();
      updateTracker(FeedInfoStatus.FAILED, msg.length() &gt;= MSG_MAX_LENGTH ? msg.substring(0, MSG_MAX_LENGTH - 1)
                         : msg);
      sendNotification();
  }finally{
      fireDBRef = null;
      System.gc();
  }
  }
  </code></pre>