posted 15 years ago
Infinite loops are rarely the cause of OOMEs, unless the loop is allocating objects and adding them to a collection. Most often, it's simply that your program is using too much memory. It's unlikely that it's the HTML, unless you've got multiple megabytes of it. More likely it's something else.
First, it may be that the program simply needs more memory. Add "-Xmx256m" to the vm arguments in the Eclipse run configuration. If it works, then your program just needed more than the default sized heap. If it still doesn't run, then it's probably something that's going out of control. First try reading the code, or better yet, getting someone else to do it, and look for excess memory usage. If that it's enough, then you can use a memory profiler (YourKit, JProbe, etc) to find out where the memory is going.