Memory Leak Issue - troubleshooting - 14 questions

Thanks Michael - I think I’ve been doing a mixture of running perfectly fine with some elements, and then attempting to run when I can’t walk with others. The annoying thing is that, other than this memory leak, the code I’ve written does actually do what i want it to do.

The win.flip() question was probably a bit dumb to include. I get the basic principle that it clears the screen. I guess I was asking because it appears at the end of loop layer 5 (the 5th nested loop) yet after it appears I’m currently having to actively use

score_text.setAutoDraw(False) 

in order to actively remove the text from the screen before the updated version of the text is drawn (otherwise it just draws on top of the original).

So if I were to rephrase that question it would be: in plain English does win.flip() just clear the screen, or am I misunderstanding this. Is there an implication of win.flip() that could result in text stimuli surviving it and thus being drawn over by future text stimuli?

Thanks for alerting me to the demos, they’ll definitely be useful to go through.

Sorry if the questions seem simple, I’ve literally gone through my code and found the 14 bits that are possible danger points for me. Some of them are just me being cautious on things i’m 95% sure I’ve got correct - e.g. ‘To my knowledge as soon as you set a variable to something else, it erases what was previously in it?’ - I’m pretty damn sure the answer is yes… I’m just scratching my head as to where a memory leak could be occurring and the trialHandler seems like a possible red flag). If any of them are answerable for you or anyone else then that would be awesome. If any seem too simple or like a waste of time then feel free to ignore them.

I am by no means anything even approaching a good programmer, but I get the principles of python and should be capable of understanding you. The code I’ve written is an entire musical pitch training scheme and is thus fairly complex, if the questions make me look like a dumbass then thats only a 67.9% fair representation of me :wink:

In general my biggest questions revolve around frames: what they are, how they work, what their implications are. Is there somewhere that you’d suggest I read about that. In the original code I just ignored all the frames stuff, so it seems that (if it isn’t the TextStim vs TextBox memory leak issue: Using TextBox instead of TextStim ) this particular ignorance of mine is a likely source of error for me.

Thanks for your help and the demos tip off