NSF
NSF

Reputation: 2549

Java program works under Windows but fails in Mac OS JVM

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?

Upvotes: 2

Views: 402

Answers (2)

javaPhobic
javaPhobic

Reputation: 476

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).

Upvotes: 2

Enno Shioji
Enno Shioji

Reputation: 26882

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!

Upvotes: 3

Related Questions