Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

Excessive memory accumulation in OSWeb experiment

Hello cogsci community,

I'm designing an online experiment in which participants are tasked to navigate a grid world and collect resources.

For this purpose I'm redrawing a canvas() object on each iteration (whenever the participant makes a move).

In principle everything functions as it should, but over the course of ~2000 iterations, my experiment accumulates ~1700mb of memory, most of which seems related to rendering / drawing (see screenshot of heap snapshot).

I've tried separating out a static and dynamic canvas, but this doesn't work because (unless I'm missing something) I cannot layer canvases. I also tried changing parts of the canvas as is possible in python, but unless I did it wrong this doesn't seem supported in javascript.

My question is: given that I'm constantly redrawing my canvas and everything in it, is the accumulation of memory to be expected, or is this indicative of something going (or me doing) something wrong? If the latter, would you have any recommendations for improvement?

Many thanks!

Comments

  • Hi @eboonst ,

    Are you running the latest version of OpenSesame/ OSWeb? There used to be memory leaks in OSWeb, but these should have all been resolved by now. If you are running the latest version, could you upload the experiment so that I can see what might cause this issue?

    — Sebastiaan

  • Hi @sebastiaan ,

    Thank you for your reply.

    Yes I'm using the latest version (4.0.24) for Mac. I'm running an ARM (M2) processor, in case that's relevant.

    Please find the experiment attached.

    Thank you for your willingness to take a look!

    Warmly,

    Evert

  • Hi @eboonst ,

    I don't actually see any obvious memory leaks when running your experiment on Google Chrome. But I guess I'm doing something different from you then. Can you give a clear description of how to reproduce the results from the screenshot above? In an automated way please, so with an experiment that runs through without requiring any key presses!

    — Sebastiaan

  • Hi @sebastiaan ,

    Thank you so much for having a look.

    I wish I had thought about an automated version, that would have saved me so many key presses while testing this.

    This version requires zero key presses after running the experiment.

    For me, the accumulation of memory is definitely less without key presses, but it's still substantial. A complete run of 120 trials consisting of ~2300 iterations (exact number can be seen under console) generates ~1.2-1.4gb of memory. On a macbook pro with an ARM M2 processor in Brave (chromium).

    I'm very curious to hear whether something similar still doesn't happen for you.


    Warmly,

    Evert

  • Hi @eboonst ,

    Thanks for the clear example! I traced down the memory leak. It should be fixed in OSWeb 2.2.5, which should appear in the automatic upgrader.

    — Sebastiaan

  • Hi @sebastiaan ,

    Thank you so much for your help! I'll be sure to keep an eye out for the updated version.

    Warmly,

    Evert

Sign In or Register to comment.