1. A method for managing memory of a runtime environment executing in a virtual machine, the method comprising: receiving an indication of an idle state of a runtime environment executing in a virtual machine; suspending operation of a plurality of threads associated with the runtime environment, wherein the plurality of threads is configured to run program code within the runtime environment; determining a plurality of memory pages associated with the runtime environment based on the indication of the idle state; transmitting, to a virtualization layer, a request to page out and compress the plurality of memory pages into a compression cache; and executing a listener thread configured to monitor for a refresh request for the runtime environment.