1).completed code on windows; 2).fixed some memory leaks;