Inline_script based GUI: "error: Out of memory"
I have been working on the same code for a while now which includes a GUI written in Python inline script. The GUI has worked for many iterations of the program in the past, but now crashes if the GUI is left active for to long. As far as I can tell, the Traceback doesn't indicate any of my code as being the problem (I could be mistaken). The error, which appears in multiple variations of the program, reads as follows:
Traceback:
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\inline_script.py", line 102, in run
self.experiment.python_workspace._exec(self.crun)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\python_workspace.py", line 161, in _exec
exec(bytecode, self._globals)
File "", line 24, in
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp\canvas.py", line 51, in canvas
return cls(experiment, *arglist, **kwdict)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\openexp_canvas\legacy.py", line 83, in __init__
self.surface = self.experiment.surface.copy()
error: Out of memory
Any assistance would be welcome!

Comments
Hi,
As of 3.1, there is an option to disable automatic garbage collection (the variable
disable_garbage_collection). When garbage collection is disabled, OpenSesame manually frees unused memory at the end of eachsequence(instead of at random intervals, which happens with automatic garbage collection). The reason for disabling automatic garbage collection is that it sometimes kicked in when it shouldn't, leading to timing glitches, and sometimes didn't kick in when it should, leading to memory errors.But if you have a very long
inline_script, the lack of garbage collection may cause memory to run out.To work around this, you can re-enable automatic garbage collection
Or occasionally force a single garbage collection with:
See also:
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!
Hi ,
I am using OpenSesame 2.9.7 with Eyelink and got an ''Out of memory'' error.
Following your advice above, I've
This time, the experiment is giving me the RuntimeError: Link terminated.
What next steps would you suggest in resolving this situation?
Defne
Hi @Defne,
The Link terminated error is (probably) unrelated to the memory error. Would you mind opening a new discussion for this, in which you describe the issue in more detail, including the complete stack trace (which you can find in the debug window) and when the crash occurs. It would also be helpful if you attach the actual experiment script to the discussion.
Cheers!
Sebastiaan
Check out SigmundAI.eu for our OpenSesame AI assistant!