I am using java.io To read Log Files and grep for ERROR/WARN etc... using
//FileManipulator class
   public static List<String> execute(String command) throws IOException{
            List<String> output = new ArrayList<String>();
            Process process = Runtime.getRuntime().exec(new String[] { "bash", "-c", command });
            InputStream input = process.getInputStream();
            InputStreamReader isr = new InputStreamReader(input);
            BufferedReader br = new BufferedReader(isr);
            String line = null;
            while ((line = br.readLine()) != null){
                output.add(line);
            }   
            input.close();
            return output;
        }
And I am getting this excption while running the same
Exception in thread "pool-1-thread-1" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOfRange(Arrays.java:2694)
        at java.lang.String.<init>(String.java:203)
        at java.io.BufferedReader.readLine(BufferedReader.java:349)
        at java.io.BufferedReader.readLine(BufferedReader.java:382)
        at com.citi.muni.msdc.sanity.util.FileManipulator.execute(FileManipulator.java:220)
        at com.citi.muni.msdc.sanity.util.FileManipulator.grepWarnings(FileManipulator.java:300)
So it seems some of the files may be too large in size to process, Can some one suggest how I can edit my current approach to stop getting the heap issue.
Thanks SK
 
     
     
    