In a virtual environment, the hypervisor can sometimes use a mechanism called a balloon driver, in the form of a virtual device driver, to implicitly communicate the amount of memory available in the outside system to the guest. This way hints that a guest should release memory or risk being swapped out, can be delivered across the virtualization abstraction barrier.
See Virtualization, Guest, Hypervisor.