VM memory exceeds allocated and increase over time

Rolling

Cadet
Joined
May 10, 2023
Messages
5
I have several VM's - Windows X - running with no problems.
But I have an VM with Home Assistant OS - running with USB card pci passthrough. I have allocated 2Gb of Ram but it increases the ram usage over time.
Some days - mostly when HA needs update it could use 20Gb ram - but only 2gb is allocated in the VM. If no update needed it uses 2.5-3Gb after 24 hours.
I dont know where to start ->

is it Bhyve
is it the PCI passthrough (dont think so)
is it HAOS that dont give a S*** about allocated mem :)

Its PID 20268 below (the win X PID 1468 has 8gb and is not increasing)

root@__[~]# top -o res
106 processes: 1 running, 105 sleeping
CPU: 1.7% user, 0.0% nice, 15.3% system, 6.3% interrupt, 76.8% idle
Mem: 3874M Active, 6313M Inact, 3280M Laundry, 17G Wired, 875M Free
ARC: 11G Total, 539M MFU, 9138M MRU, 1222M Anon, 52M Header, 329M Other
9001M Compressed, 9893M Uncompressed, 1.10:1 Ratio
Swap: 6144M Total, 375M Used, 5768M Free, 6% Inuse

PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
1468 root 16 20 0 8250M 7670M kqread 1 310:04 5.52% bhyve
20268 root 14 20 0 3166M 2549M kqread 1 173:14 10.14% bhyve
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
Why are you running that memory check on the NAS and not the VM itself? TrueNAS RAM usage will always be high because it uses most of it on ZFS ARC (11G in your logs). It's perfectly fine, you WANT it to use that RAM. Unused RAM is wasted RAM.

Also, the hypervisor typically has to reserve extra RAM for doing its job. Your RAM usage is never just the RAM allocated. There is always some overhead for it to handle all the virtualizations.
 
Last edited:

Rolling

Cadet
Joined
May 10, 2023
Messages
5
This brought me a little closer. I checked the ram usage in the VM and its almost nothing (0.6Gb and says total of 2Gb ) but in the nas its 6230Mb only on this VM after 8 hours. Now i'm suspecting the pci pass through again - could this communication fill up ram if fx. it cant deliver the data to VM??
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
It's possible. What exactly are you passing through? What kind of device is it? Some devices do require extra RAM (iGPU for instance).
 

Rolling

Cadet
Joined
May 10, 2023
Messages
5
USB card - with only 1 zigbee device pluged in - dont know how much data that is but cant be as a GPU.
- must clearify that the ram usage increase - its growing - and after fx. a week it kills other vm's and Truenas gets extremely slow (I guess 3-4 Gb per day)
 

Rolling

Cadet
Joined
May 10, 2023
Messages
5
I have deactivated pci passthrough - still same - cloned the VM - still same - i will soon reinstall HA but would like to know 1 thing - In what situation would bhyve alow the VM to use more ram than dedicated - its only HA that takes more ram than given. In my opinion it should newer be possible to use more than given.
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
Is it really using more than given? What is the output of free -h on HA shell?
 

Rolling

Cadet
Joined
May 10, 2023
Messages
5
Is it really using more than given? What is the output of free -h on HA shell?
Not sure where to type that - HA console does not recognise it - but i can measure ram in HA, settings, hardware - takes a long time but it says 0,6Gb when Truenas shows above 10Gb - the increase is very slow but when pressing update in HA - it rampup 200mb /s - until all ram is used and vm's shutsdown automatically.
 

Whattteva

Wizard
Joined
Mar 5, 2013
Messages
1,824
Not sure where to type that - HA console does not recognise it - but i can measure ram in HA, settings, hardware - takes a long time but it says 0,6Gb when Truenas shows above 10Gb - the increase is very slow but when pressing update in HA - it rampup 200mb /s - until all ram is used and vm's shutsdown automatically.
Sorry, I'm not really familiar with HA and don't use it. I hope someone else can step in and help you.
 
Top