I have a Java application "A" running on Linux. It makes REST calls to another Java program "S" running as a service on top of Liberty. "S" is getting killed, presumably due to lack of memory. I have tried instrumenting both Java programs using "virtualvm" and "top", and what I'm observing from both seems contradictory. For example, virtualvm indicates that "S" has a "size" of ~2.8GB, while "top" says that "S" has a "VIRT" memory size of over 13GB. If I believe "top", it's reasonable that the program should be getting killed, but if I believe "virtualvm", it seems like there is plenty of headroom.
Can someone explain this discrepancy, and advise me which instrument to believe?