Skip to content

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

@Homaid

Description

@Homaid

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()
  
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions