Computer freezing instead of uploading

sometimes when i upload or complie a sketch the progress bar stops half way in the compiling stage. after it freezes like this i can press the upload button again and it will upload no problem but the freeze in the program causes my cpu to be bogged down. if i open task manager i see either as.exe, Java(TM) platform SE binary, cc1plus.exe, or avr-g++.exe is taking up 50% of my cpu. i cant stop these tasks with end process and if i close the arduino software another one of them(ive seen every combination of 2) taking up another 50%. at this point i cant do anything because 100% of the cpu is being use by these 2 processes that seem to do nothing. i am forced to restart my computer.

this happens every couple uploads, sometimes it happens back to back and i get completely bogged down without closing the arduino software.

I have version 1.0.5-r2 of the software, and am using a Mega 2560

What should i do to stop it doing this?

Attached a screen shot of the freeze that happened as i wrote this. this is about 2 min after i pressed the compile button as the arduino wasn't even plugged in. i wanted to say how big the code was once complied. After i took the screen shot i pressed the compile button again and it did no issue. the sketch is 24090 bytes so not that big considering the mega's limits

-Matt

Edit: I have 2 monitors, the screen shot is my entire desktop at the time.

this was hard to take. but it is a screen shot after i closed the arduino software. the 2 processes were going between 48-51% each

-Matt