Reuse your visual objects
Similar to Wakefield's Daily Tips - #7 by wakecarter.
If you use visual components, then they are all created during Begin Experiment and then updated as you change the parameters, whether every repeat or each frame.
If you create visual objects in code, you should mimic this behaviour. Create the objects in a Begin Experiment code component tab, and then make changes in code. If you create visual objects in Begin Routine within a loop then you the memory load will increase with the total number of objects created, which can eventually cause PsychoPy to crash.
Thank you to @dgrtz for identifying this issue. While the memory overload may only occur online, I would also recommend this tip for local experiments as good practice.
There may be exceptions, however, if you do not know how many simultaneous objects you will need at Begin Experiment. In that case, ensure that the total number of new objects is kept to a minimum.