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 ?
What you have specified via the -Xmx switches is limiting the memory consumed by your application heap. But besides the memory consumed by your application, the JVM itself also needs some elbow room. The need for it derives from several different reasons: Garbage collection.
Memory Management in Java refers to allocating and deallocating memory to java objects which reside in areas called Stack and Heap. Java has an automatic memory deallocation system known as Garbage Collector.
JVMs allocate memory on an as needed basis from the operating system. Generally, when the JVM starts, it will allocate the minimum memory allocated (Xms) to the application that is running. As the application requires more memory, it will allocate blocks of memory until the maximum allocation (Xmx) has been reach.
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).
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With