Mike
2009-04-02 09:36:46 UTC
I am writing a program that is supposed to take a 18MB text file, parse it and enter it into a a data structure to keep track of stats on each word (like frequency, next words and their frequencies.)
I have decided to store everything in Binary Search Tree of my own implementation but the problem is that when my program actually populates the tree I eventually get that "Java heap out of memory" error.
I think the default heap size is 128 MB so I don't understand why my program runs out of memory.
Each node of my tree contains a string, a double (the word's frequency), and an ArrayList of nodes (to represent my list of words that could possible come after each word)
My hunch is that it runs out of memory when I add nodes to the ArrayList but I am not sure. I thought that maybe it has something to do with the fact that I keep running the program over and over ...
I am not sure about this ...
Anyone have any suggestions?