[vbox-dev] Releasing memory to the host

Vivek Thakkar vivekt.vivek at gmail.com
Mon Nov 23 06:35:01 GMT 2020

Hi Alexander,

Thanks for the prompt reply. The issue with giving less memory to the VM is
that sometimes the VM needs higher memory which it releases at a later
point of time.
My understanding is that the limits specified in the VM settings get
accounted for as a "reservation" for the physical memory for the VM. The
allocations still happen on a demand basis in units of chunks (2 MB). Isn't
this understanding correct? Also, there is a free chunk worker implemented
in GMMR0.cpp which tries to free up the chunks based on some heuristics
(like all pages of the chunk are released and the chunks in the previous
node and next node of the free list are also empty). Currently, this free
chunk worker releases memory to the host only if the VM shuts down. Isn't
it possible to trigger this based on a special guest hypercall, or some


On Fri, Nov 20, 2020 at 8:20 PM Alexander Rudnev <
alexander.rudnev at oracle.com> wrote:

> Hi Vivek,
> VirtualBox allocates physical (non-swappable) memory with the amount set
> in VM settings. This memory can't be returned back to the host nor fully
> nor partially. Why don't you want to specify 1Gb of RAM in VM settings
> having your VM requires less? That seems as a solution to me.
> On 20/11/2020 14:10, Vivek Thakkar wrote:
> > Hi,
> >
> > We are running a 32 bit linux guest on a 64 bit windows host using
> > VBox.  Although the guest is configured with 4 GB RAM, it usually
> > consumes around 700-800 MB in steady state. However, during bootup the
> > guest may use around 1.5 GB RAM. Even otherwise, we expect that there
> > would be some peak memory usage that may happen in the guest but in a
> > steady state very less memory would be used.
> > Currently, the VBox doesn't seem to free up the memory (allocated for
> > the guest context) to the host even if the peak load has passed as there
> > is no guest to host interface that would tell the hypervisor to free up
> > the memory. If we are okay with paravirtualization of the guest, would
> > it be possible to modify VBox to release this memory to the host? How
> > can we do it - any pointers on this would be really helpful.
> >
> > Our main objective is to release the memory pressure on the host, so
> > that it doesn't impact the system performance (other apps on the host
> > can use the extra memory for its allocations without paging).
> >
> > Regards,
> > Vivek
> >
> > _______________________________________________
> > vbox-dev mailing list
> > vbox-dev at virtualbox.org
> > https://www.virtualbox.org/mailman/listinfo/vbox-dev
> >
> --
> Alexander Rudnev | VirtualBox | work  +7 (812) 334 60 01 | cell +7 (921)
> 951 82 04
> Oracle Development SPB
> Chkalovsky pr. 50, Saint-Petersburg, 197136, Russia

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20201123/15d0a994/attachment.html>

More information about the vbox-dev mailing list