This can occur if VirtualBox is running on FreeBSD:
You have plenty of ram left and try to copy a large file.
Suddenly, and at random points, the copy will abort, i.e. with a message like "write failed" and a memory error.
Adjust your virtualbox settings in /boot/loader.conf to have this setting for netgraph:
The person who originally asked about this problem wanted to get a warning into the port but was ignored.
I hope the wiki article will help some people find the solution faster.