OutOfMemoryError when there seems to be plenty of memory

Questions about YourKit Java Profiler
Post Reply
Head
Posts: 4
Joined: Mon Mar 28, 2005 9:25 pm

OutOfMemoryError when there seems to be plenty of memory

Post by Head »

Sorry if this is the wrong forum for this but there's no other forum that seems right for this sort of question.

I purchased yourkit because we are having more and more frequent OutOfMemoryErrors when we run Tomcat. We start it with -Xmx768m and -Xms128m which seems like it should be enough.

I have attached to a running instance of Tomcat that is getting the OutOfMemory messages but it is only using about 100MB. And, yes, I did the object allocation to see how much garbage we are getting and it's around 10-30MB (nowhere near the 668MB that would be need to fill up the 768MB max).

So what's going on? What else could be causing the OutOfMemoryError? I've started thinking maybe it's related to -Xss but I don't have much knowledge of its effect. We do have quite a few Contexts which probably generates a lot of threads... maybe that's where the problem lies. But I don't know that yourkit can help with this sort of problem, can it?

Any thoughts or suggestions are welcome.
Head
Posts: 4
Joined: Mon Mar 28, 2005 9:25 pm

Post by Head »

After some google research, I'm quickly coming to the conclusion that threading is my memory issue. On Linux, each thread defaults to taking 8MB and my Tomcat starts out with 77 threads and grows from there... that means I'm starting at a base of 600MB just for the thread stacks!

It's a constant learning process... that's why it's so fun!
Post Reply