3 ms·
You do understand that heap size != memory footprint, right? The JVM has its own memory footprint before you start allocating java objects.
by dbt00 6y ago
You do understand that heap size != memory footprint, right? The JVM has its own memory footprint before you start allocating java objects.
- exabrial 6y agoYes. So the absolute worst case scenario is one our 128mb heap apps that uses direct memory byte buffers for off-heap object caching. It's resident set size is roughly 387m, which up to 196m of that is byte buffers. I can tell using JPS the heap is full allocated, and the application has been running for several weeks so I imagine the cache is full. That leaves an overhead of 64m.
- exabrial 6y agoFor funzies, I looked at one our ActiveMQ Message brokers, which are ran on 1g machines with a 640m heap. The heaps are fully allocated and the resident set size is ~658m. Linux reports it has 66M of free memory and 95M of available ram. 440m of swap is being used and is only lightly being paged out under light load of 400 msgs/s. This same setup can push 2000msg/s before GC thrashing becomes an issue and we need more heap. So no, I don't think there's any truth to the claim "Hotspot always uses an extra 256m of memory". Sounds like the kernel is doing what it's supposed to: free memory is wasted memory.