2

Well I have a java program written under Windows and it works well. Basically it's algorithm related and during the time it's running it usually consumes almost full CPU capacity, which is normal.

However under MacOS it always gets stuck at some particular point where there is a large amount of data and memory consumption reaches at about 240M. The program is still running but doesn't move on. The memory is not released but the CPU usage drops to 0. I don't know what this exactly means and I have no idea what's going on.

Sorry I can't provide the code piece since this is not a problem regarding specific part of the code. Anybody who is familiar with JVM can give some hints/advice?

3
  • Try to run your program on windows 64 bits 1.6 JVM (that is the jvm of mac) Commented Sep 13, 2012 at 0:16
  • What arguments are using to start the JVM? If your code is eating up the whole CPU -- something is clearly wrong. Can you provide the code that's doing the heaviest computations? Commented Sep 13, 2012 at 0:16
  • @debracey He mentions it's a CPU intensive code. It's normal to eat up the whole CPU in that case.. otherwise you are doing something wrong. Commented Sep 13, 2012 at 0:20

2 Answers 2

3

First thing I would do is to take a thread dump and find out who is doing what. You can issue a kill -3 to obtain a thread dump, or you could also hook-up a profiler. For details, please see this answer: Thread Dump Analysis Tool / Method

You might want to post the thread dump here if you have trouble figuring on what is going on.

My wild guess is be a concurrency bug, like a dead lock but we'll have to see the thread dump!

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks. The problem was due to out of memory. I first tried to increase JVM memory quota and it worked but it didn't solve the real problem. Then I tweaked my program and now it works fine. :)
2

If your hard drive is busy when this happens, then it means your JVM is using more than available physical memory, and it's just swapping the swap file. The swapping process itself does not use much CPU but lots of I/Os is involved in the process. Hence CPU usage is low.

Try to limit your heap size to the available physical RAM (Don't increase to total as it's possible that 4 GB machine may only have 1 GB free at the time launching your JVM).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.