Well, lets break this down to what you need and what you have:-
Your base OS (Win 8) requires 2gb of RAM to function (assuming you're using x64), if you lower it down to this level then it will run, but it will run slow.
Ubuntu requires 512mb of RAM to function, so taking 512mb is going to be a minimum. Ubuntu also needs 5gb of disk space to install.
The obvious solution is to split the ram 50/50 and give each OS 2gb, this is enough for both of them to function, but your programs requirements are 5gb, so you may still have trouble even when giving as much as possible to Ubuntu.
As far as disk space is concerned, calculate what you need in total (5gb+20gb) then add another 1/3 on top of it for spurious log files and other unforeseen applications, so you're looking at about 35gb of hard disc space.
Overall, I don't think your laptop is suitable for running the application you're trying to run due to the sheer lack of RAM available.