No, I don't hit OOME if I comment out the call to getHTMLTitle. The
heap
behaves perfectly.
I completely agree with you, the thread count goes haywire the
moment I call
the HTMLParser.getTitle(). I have seen a thread count of like 600
before my
I hit OOME (with the getTitle() call on) and 90% of those threads
are in
wait state. They are not doing anything but just sitting there
forever, I am
sure they are consuming the heap and never giving it back.
Just FYI, on Linux platforms (and I think Windows) the default stack
size for a thread is 1Mb. 600 extra threads is 600Mb of virtual
address space, that's outside the heap though so is unlikely to be the
cause of an actual OutOfMemoryError (if that is actually what you're
seeing, it's not a different sort of memory error is it?). Even if
you fix the OOM condition, but still have 600 threads lying around
you're on your way to a serious problem on a 32-bit Operating system
which usually causes a process a horrible death when it's virtual size
reaches the magically 3Gb mark. It' only takes 3000 threads (only x5
more than you have) even without any _heap_ space utilising the
virtual address space before you reach the cliff with the jagged rocks
of process death below.
Hope that helps too.
cheers,
Paul