问题
The problem that I faced is my application's memory used is only 100MB after that it decreased 50MB, but on Window Task Manager it showed 150MB and always keep or increase but not decrease, How can we reduce Memory (Private working set) on task manager ?
回答1:
What you are seeing in JConsole
(or other monitoring tools) is the pattern the java memory is being used.
The memory of the JVM is usually divided among these areas (what you also see in monitoring tools).
- Heap memory which is for Java objects
- Non-heap memory which is the place where java stores loaded classes and metadata and the JVM code
- Native memory which is a part of memory reserved for dll's and
native code of Java (very low level). Sometimes you could get a OOM
in this area while you got enough heap memory (because as you
increase the
Max Heap
size, it reduces the native memory available).
The windows task manager does not show that. It shows the whole memory used by your application (heap + non-heap+ native part).
Also note that usually processes that request more memory from OS, this memory is kept by them even when the actual application "frees" memory. These memory pages have been mapped as part of the processe's address space. So in your Task Manager you would not see a pattern of decreasing memory, but that would not indicate some memory leak from your application.
So you can not reduce the memory you see from task manager but the memory you see from the monitoring tool should decrease at some point, otherwise that could indicate a memory leak
来源:https://stackoverflow.com/questions/12017437/jvm-memory-why-memory-on-task-manager-difference-with-jprobe-or-jconsole-tool