Hi all,
I'm trying to allocate a dataspace dynamically at runtime and transfer
quota accordingly. However, it seems the allocation always requires more
quota than the actual allocation size.
E.g.
Genode::Ram_connection ram;
ram.ref_account(Genode::env()->ram_session_cap());
Genode::Ram_dataspace_capability ds;
Genode::env()->ram_session()->transfer_quota(ram.cap(), 32*1024);
PDBG("Quota: %d/%d\n", ram.used(), ram.quota());
ds = ram.alloc(28*1024);
PDBG("Quota: %d/%d\n", ram.used(), ram.quota());
This shows 0/32769 on the first print and 28672/32769 on the second which
is exactly what you'd expect. Allocating 29 KiB with a 32 KiB quota,
however, will throw a Quota_exceeded exception, still printing 0/32769 on
the first print.
It seems you need about 4 KiB of spare quota but I can't seem to find any
doc on this. How much quota should I actually reserve for simple
allocations like this and why isn't it simply the same as the actual
allocation size? I'd like to avoid magic numbers and wasteful allocation if
possible.
Cheers,
Georg