# bhyve uses over allotted memory



## pestslent1 (Dec 6, 2019)

Lately my box has been locking up due to all memory being full (swap (10G) and real (32G)).
When I view  the "system monitor" it shows my vm's in the stopped state and using more memory than allocated in the configs of each vm.
This a recent problem, that I believe happened after I upgraded 2 of the vm's from win7 to 8.1 (the 8.1 installs use the same config files as the 7's did). I also had updated my pkg 's.
I first noticed it when I was copying the .img files to a UFS formatted drive as backups. I thought is was a ZFS issue so added  "vfs.zfs.arc_max="17G"  to my loader.conf. (the problem also happened when just running vm's after that point)
I have pkg "vm-bhyve 1.3.0" on 12.1-RELEASE-p1 on a ZFS partition: "ryzen 7 1700 (overclocked to 3700Mhz, if that matters) 32 GB of ram on a MSI x370 Gaming Plus motherboard with the latest bios".
I use bhyve to run 3 vm's (all windows (2012r2 server(7G of memory) and 2 8.1 (each with 3G of memory)). My 8.1 installs were win 7 but recently upgraded to 8.1.
The vm .img are on a separate zfs formatted nvme drive.
For the most part all this box does is run those vm's and had run well for a year-ish.


my rc.conf


```
zfs_enable="YES"
clear_tmp_enable="YES"
hostname="vmbsd"
ifconfig_re1="inet 192.168.1.66 netmask 255.255.255.0"
ifconfig_re0="inet 192.168.1.69 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sendmail_enable="NONE"
kld_list="/boot/modules/amdgpu.ko"
dbus_enable="YES"
hald_enable="YES"
sddm_enable="YES"
powerd_enable="YES"
powerd_flags="-a hiadaptive"
xrdp_enable="YES"
xrdp_sesman_enable="YES"
samba_server_enable="YES"
fuse_enable="YES"
vm_enable="YES"
vm_dir="/storage/vm/"
vm_list="2012r2 8vistadl 8teamBSD"
vm_delay="5"
smartd_enable="YES"
```

this is my loader.conf

```
kern.vty=vt
zfs_load="YES"
vfs.zfs.arc_max="17G" (added this to try and fix my issue:did not help)
fuse_load="YES"
kern.geom.label.disk_ident.enable="0"
kern.geom.label.gptid.enable="0"
vmm_load="YES"
nmdm_load="YES"
if_bridge_load="YES"
if_tap_load="YES"
hw.vmm.amdvi.enable=1
hw.vmm.topology.cores_per_package=4
#hw.vmm.topology.threads_per_core=2
pptdevs="42/0/3"
#pptdevs="40/0/0"
#pptdevs="36/0/0"nic
hw.syscons.disable="1"
#snd_driver_load="YES"
amdtemp_load=YES
```

these arm vm configs:
2012r2

```
loader="uefi"
cpu=4
memory=7G
bhyve_options="-S" (added this to try and fix my issue:did not help)
graphics="yes"
xhci_mouse="yes"
graphics_res="1600x900"
network0_type="virtio-net"
network0_switch="public"
debug="yes"  (enabled to get more info on my issue)
disk0_opts="sectorsize=512"
disk0_type="ahci-hd"
disk0_name="BackupR7.img"
disk1_dev="custom"
disk1_opts="sectorsize=512"
disk1_type="ahci-hd"
disk1_name="/dev/ada0,hd:/dev/ada1"
disk2_dev="custom"
disk2_opts="sectorsize=512"
disk2_type="ahci-hd"
disk2_name="/dev/ada2,hd:/dev/ada3"
uuid="762f78e9-270b-11e8-87a4-309c230c9abc"
network0_mac="02:15:5d:45:32:01"
```

8.1

```
loader="uefi"
cpu=2
memory=3G
bhyve_options="-S"   (added this to try and fix my issue:did not help)
graphics="yes"
xhci_mouse="yes"
graphics_res="1600x900"
network0_type="virtio-net"
network0_switch="public"
debug="yes"    (enabled to get more info on my issue)
disk0_opts="sectorsize=512"
disk0_type="ahci-hd"
disk0_name="8teamBSD.img"
disk1_opts="sectorsize=512"
disk1_type="ahci-hd"
disk1_name="OfficeFiles.img"
passthru0="42/0/3"
network0_mac="58:9c:fc:0a:da:8c"
uuid="7676731a-8500-11e8-8bf4-309c230c9bbc"
```

2nd 8.1

```
loader="uefi"
cpu=2
memory=3G
bhyve_options="-S"    (added this to try and fix my issue:did not help)
xhci_mouse="yes"
graphics_res="1600x900"
graphics="yes"
network0_type="virtio-net"
network0_switch="public"
debug="yes"    (enabled to get more info on my issue)
disk0_opts="sectorsize=512"
disk0_type="ahci-hd"
disk0_name="8vistadl.img"
network0_mac="58:9c:fc:0c:9a:59"
uuid="717bbf0c-8500-11e8-8bf4-309c230c9abc"
```

Does anyone have any Ideas or suggestions to remedy this?
Please let me know any error in my configs.
Thanks


----------

