WebGL and memory: Context lost

URL of experiment: Sign in · GitLab

When I pilot the experiment in Safari, the browser complains that the experiment is using too much memory and eventually reloads the entire experiment after only two trials or so. When I pilot it in Chrome, I get the following WebGL error message after a while (also after only a few trials):

The experiment freezes but regains context after 4-5 seconds. Judging by the ‘Memory’ tab in Chrome, it also looks like the experiment is using a lot of resources - I don’t understand why, since I’m not using heavy graphics or anything like that. Any ideas?

Did you solve this? I think I’m getting a memory overload error when using a mobile device after several trials which successfully update the size and position of a single image file.

Best wishes,

Wakefield

No, I was also trying to run this on a mobile device but had to give up as it crashed every time. On a laptop, I managed to run the experiment in both Chrome and Firefox (but not Safari) with Firefox giving the best performance.

/Johanne

I think I’ve just solved (worked around) my problem by replacing my one moving image with a polygon.

I might get ambitious and try a shapestim or a second polygon to improve the shape

I’m having a similar problem with my experiment:

On each trial, I am showing a jpeg on screen with a few polygons, a few of which are acting as clickable buttons. Participants then rate the image on a couple of scales (with the image present on screen in few routines… However, after about 40-50 trials, the screen flashes white briefly. The rating scales and text in the subsequent routines then seem to render in a very weird way, though the jpegs and polygons seem to render just fine.

In the javascript console, I see the same error about the context being lost as reported above. My experiment involves presentation of a few hundred small jpegs (all under 20 kb).

I could probably try shrinking the files further, but they are already very compressed. Changing the size of the images within psychoJS also didn’t help.

Any help with this would be appreciated, as I’m at my wits end trying to fix this.

There are two main solutions for this:

One is here and should be incorporated in version 2020.2

The other is ensuring that you don’t have any components set to update every frame and only set stimuli in Each Frame code components when the variable has actually changed.

1 Like

Thanks a lot! Those changes fixed things for me.