processing / processing/p5.js

Unmatched push() calls cause progressive performance degradation and browser freeze (no warning)

Open
#8,209 8 comments 0 reactions 1 assignee View on GitHub

@Homaid is already working on this.

Since Oct 27, 2025.

Area:Core Bug Friendly Errors
Dominant language
JavaScript
Stars
24k
Forks
3.8k
Avg merge
3d 16h
Merged PRs (30d)
25

Description

Most appropriate sub-area of p5.js?
  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • p5.strands
  • WebGL
  • DevOps, Build process, Unit testing
  • Internationalization (i18n)
  • Friendly Errors
  • Other (specify if possible)
p5.js version

1.11.10

Web browser and version

all browser

Operating system

windows 11

Steps to reproduce this
Steps:

1.Create a new p5.js sketch with the code below
2.Run the sketch
3.Observe that the animation starts smoothly but becomes progressively laggy after 3-4 seconds
4..After 6-7 seconds, the entire browser tab freezes and becomes unresponsive
5.Notice there are no console warnings or errors about unmatched push/pop calls

Snippet:

function setup() {
  createCanvas(800, 800);
}

function draw() {
  background(220);
  translate(width/2, height/2);
  
  for (let i = 0; i < 100; i++) {
    push();
    rotate(frameCount * 0.01 + i);
    translate(i * 2, 0);
    rect(0, 0, 10, 10);
    // Missing pop()
  
  }
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.