sounds wrote:No, not putting it on github, the code is in this thread.
Fair enough that you don't want to make your code public (though if you know for sure that the problem is in the code you have posted you should be able to track it down - but I don't see how you can know that for sure). You must realise that this makes it far more difficult for people to help you. In fact, if your reasons for keeping your code secret is that you eventually want to monetise it (what other reason is there for not sharing code?), why would you expect people to give their time to help you?
As for a bug in VirtualBox - bugs do happen in code, but it is highly unlikely that such a bug would have gone unnoticed. The reality is that by far the majority of problems with low-level code are the result of the coder making unwarranted assumptions, or silly mistakes, rather than a bug in their toolset.
A lot of other issues could be causing your problem - the VM configuration, your BIOS setting, particularly those related to virtualisation, what other software is running on your computer, etc. The best plan is to take everything back to the simplest level, in particular ensuring that you are not running any other virtualisation software, virus-checking software, etc., to see if this affects what is happening. With just a snippet of code and no real details of your hardware/software setup it's difficult to be more specific.