Indeed, Refactor your code into functions or commands and set all that you possibly can to local even if your not threading. If you find your self copying and pasting like a set command more than once turn it into a function or command. What happens in a function is that the memory slot is gone after use, meaning there is no build up of memory as in the case of making several set commands. Stick all your "global" variables in a list or some kind of dictionary instead of a bunch of variables that are sucking up memory and building with each reference to them. in a list called %globals