Firebase addvalueevent listner consuming memory if data is in large amount : Thanks in advance.

    global.getDatabaseReference().child(ApplicationConstants.TOPIC_DB).child(Util.getSelectedBoard(context)).child(Util.getSelectedClass(context)).child(Util.getSelectedLanguagePackage(context)).child("CategoryId_1").child(subject).child(ApplicationConstants.TOPICS).addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot) {
                    try {

                        topicContentArrayList = new ArrayList<>();
                        HashMap<String, HashMap<String, String>> modelHashMap = null;
                        int pos =0;
                        for (DataSnapshot single_ : dataSnapshot.getChildren()) {
                            modelHashMap = new HashMap<>();
                            HashMap<String, String> innerTopicNode = (HashMap<String, String>) single_.getValue();

                            innerTopicNode.put("mastery", "0");
                            innerTopicNode.put("enabled", innerTopicNode.get("Display"));
                            innerTopicNode.put("currentLevel", "1");
                            innerTopicNode.put("flag", "Done");
                            innerTopicNode.put("score", "0");

                            modelHashMap.put(pos + "", innerTopicNode);
                            pos++;
                            topicContentArrayList.add(modelHashMap);

                        }
                                         } catch (Exception e) {
                        e.printStackTrace();
                    }
                }

                @Override
                public void onCancelled(DatabaseError databaseError) {

                    Util.dismissdataDialog();
                }
            });



Here is the memory error
Background partial concurrent mark sweep GC freed 277003(9MB)
It is blocking the UI and I'm unable to perform click action for some time.
Please Help me to get out from this issue.
