开发者

Java memory usage difference between Linux and Windows

When running the same java process (a jar) under Windows and Linux (Debian) the Linux proces uses a lot more (12MB vs 36 MB), just from starting up. Even when trying to limit the heap size with -Xmx/Xms/etc, it stays the same. Nothing I try seems to help and the process always takes 36 MB. What explains this difference between Linux and Windows and how can I reduce the memory usage?

EDIT: I measure memory w开发者_运维知识库ith the windows task manager and Linux top command. The JVM are the same and they are both 32-bit systems.


I recommend using a profiler such as VisualVM to get a more granular view on what's going on.


One question I would ask to help me understand the problem better is :

Does my Java application's memory profile look dramatically different on the two platforms? You can answer this by running with -loggc and viewing the output in a gc visualizer like HPjmeter. You should try to look at a sample set with a statistically significant amount of data, perhaps 1000 or 10000 gc plots. If the answer is no, I would be tempted to attribute the difference you see to the JVM heap allocation requirements for start up. As 'nos' pointed out, pinpointing the difference can be notoriously hard. When you specified the -Xmx value on Linux, did the memory utilization exceed your Xmx value?


It is probably measuring the shared memory as well

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜