Switched to a faster memory measurement method and fixed the input and output redirection of the subprocesses.