Skip to content

[Bug] Chrome out of memory on large programs #1804

Open
@laurensvalk

Description

@laurensvalk

While creating a few big programs to test the limits of our hub file storage, I noticed that Pybricks Code can crash Chrome. In one case, it dropped into the debugger before the potential memory issue. In other cases, Chrome crashes with SIGILL.

This is a bit of an unusual program, but not entirely out of the ordinary. If someone wants to include a binary blob to include some extra data, a program may look not unlike the one below.

Example. long_program.py.txt

It still works if you cut it in half. It's only 18Kb as a compiled .mpy program. Should probably retry with randomized strings to avoid string compression being a factor.

from pybricks.hubs import PrimeHub
from pybricks.pupdevices import Motor, ColorSensor, UltrasonicSensor, ForceSensor
from pybricks.parameters import Button, Color, Direction, Port, Side, Stop
from pybricks.robotics import DriveBase
from pybricks.tools import wait, StopWatch

hub = PrimeHub()

data = b"132456789132456789132456789132456789132456789132456789132456789132456789"
data = b"132456789132456789132456789132456789132456789132456789132456789132456789"
data = b"132456789132456789132456789132456789132456789132456789132456789132456789"

# Repeat this MANY more times. Too big for a GitHub post. See attachment for whole file.

data = b"132456789132456789132456789132456789132456789132456789132456789132456789"
data = b"132456789132456789132456789132456789132456789132456789132456789132456789"
data = b"132456789132456789132456789132456789132456789132456789132456789132456789"
data = b"132456789132456789132456789132456789132456789132456789132456789132456789"

hub.light.on(Color.BLUE)
wait(10000)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsoftware: pybricks-codeIssues with https://code.pybricks.com application

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions