Some more attempts at being better at memory handling + remove useless and untested cygwin stuff.