Severe memory leak issue for all browsers, task crashes for the majority of participants

Hi @sotiri , sorry, one more question: I have just noticed that there was an issue with saving data for my retest trials (which present a subset of stimuli in the main trials to get an estimate for test-retest reliability). I basically only need 8 retest trials and I did so by ending the retest loop early once the count reaches 8. so I have the following code in ‘end routine’:

if (trialCounter === 8) {
    retest_trials.finished = true;
    psychoJS.experiment.nextEntry();
  }

I think the psychoJS.experiment.nextEntry();line was needed at the time when I first developed the task in order for the data to save correctly. perhaps following instructions from here (couldn’t remember now): Experiment not saving data Online, generates empty CSV files. However, I just noticed that loop variable (e.g. in video task, the name of the clip) for the last/8th retest trial doesn’t match what was presented (the first 7 do). I couldn’t find the relevant code in the js file for writing the loop variable into data files by searching for the addData function. Am I correct that saving the loop variable is handled in the following function? And somehow because I end the loop early that it actually saved the 9th trial into the data? I believe that getting rid of the psychoJS.experiment.nextEntry();line solves the problem and saves the correct 8th trial.

function endLoopIteration(scheduler, snapshot) {
  // ------Prepare for next entry------
  return function () {
    if (typeof snapshot !== 'undefined') {
      // ------Check if user ended loop early------
      if (snapshot.finished) {
        // Check for and save orphaned data
        if (psychoJS.experiment.isEntryEmpty()) {
          psychoJS.experiment.nextEntry(snapshot);
        }
        scheduler.stop();
      } else {
        const thisTrial = snapshot.getCurrentTrial();
        if (typeof thisTrial === 'undefined' || !('isTrials' in thisTrial) || thisTrial.isTrials) {
          psychoJS.experiment.nextEntry(snapshot);
        }
      }
    return Scheduler.Event.NEXT;
    }
  };
}