I run out of RAM at 4/8gb usage?

I recently set up a minecraft server for me and my friend and I had to allocate both the client and the server 2GB of RAM each. I have 8GB of RAM installed on my laptop (Lenovo Z580) however my laptop usually closes either the minecraft server or the client for not having enough RAM even though I still have around 3GB of RAM left? I'm running Windows 8.1 Pro and would appreciate any help with this issue.

It's quite obvious your friend doesn't have enough isn't it?

First you should up grade the memory

HERES HOW TO FIX IT
Make sure to Name your Minecraft_server1.7.4 or whatever to Minecraft_Server

1. Then Create a new notepad file
2. Inside put this:

If you're on 64 bit
"C:\Program Files\Java\jre7\bin\javaw.exe" -Xms2048m -Xmx2048m -jar "Minecraft_Server.exe"

If you're on 32 bit
"C:\Program Files (x86)\Java\jre7\bin\javaw.exe" -Xms2048m -Xm2048m -jar "Minecraft_Server.exe"

Where it says xms2048m Thats 2 GB of RAM for your server If you want more follow this:
1GB: 1024M
2GB: 2048M
3GB: 3072M
It goes in 1024 increments
Where it says jre7 id youre on Java 6 put jre6 there

3. Then when your done typing CLick "Save As" at the top
4. Then instead of txt document put all files
5.Save it as run.bat
6.Put it in the same folder as your minecraft server is in.
7.Done
If youre on Bukkit Tell me and Ill show you how to do it.
If you don't get that look at this video below at 9:48