Perhaps this is a problem others are already aware of, but in case it isn’t, I’m posting it here to make others’ lives easier in future.
We’ve been testing two versions of an EEG task with different stimulus types (text stimuli, and images), and in both experiments the memory usage was rapidly increasing following each trial (to the extent that, at some point, PsychoPy would crash with a memory error). After some problem-solving, it turned out that the issue was that we had included print statements during debugging that would indicate which triggers were being sent to the parallel port, and doing this was for some reason hogging massive amounts of RAM. Turning off the print statements fixed the problem. (Additionally, one of the tasks had warning messages appearing in the output tab which were having the same effect; changing the code to obviate the warnings fixed that.)
So, the moral of the story is: If you’re getting a memory error, it’s possible that minimising whatever is printed as output will help. (The error occurred for us on version 2022 2.2.)