improves readFileInMemory, adds maybeGC

also minor change in converToUTF16