MenuSettings and looks / Time and memory limits

Docs / Settings and looks

Time and memory limits

JSpark stops a Run that stays busy too long or uses too much memory. Here is what each limit counts.

On this page

Both limits are in Settings → Running. A new setting applies from the next Run.

In JSpark, the Time limit goes up to 5s and the Memory limit is fixed at 1 GB.

The time limit

Time limit stops code that stays busy this long without a pause, such as an endless loop. The default is 5 s. JSpark allows up to 5 s; JSpark+ up to 10 s.

  • In a Node Run, only busy time counts. A server, a timer or a file watcher that waits between events keeps running until you press Stop (⌘. or Ctrl+.).
  • In the Timeline, the limit counts the whole recording, from start to end.

Most endless loops are stopped sooner, by the loop guard. After 20,000,000 turns of one loop, it stops the Run with an error that names the line. Click the line in the error to go to it.

A loop that never changes tries is stopped by the loop guard, which names line 2.

The memory limit

Memory limit per run stops a Run that uses more memory than this, before it slows down your computer. The default is 1 GB.

  • In JSpark, it is fixed at 1 GB. JSpark+ can set it from 256 MB to 8 GB.
  • A Node Run never gets more than half of your computer’s memory, whatever the setting says.
  • In the Timeline, the recording may use up to half of the limit.

When a Run is stopped

When a limit stops a Run, the console shows a card that names the limit, and keeps everything the Run printed before it. The footer says the same in short: Stopped: busy for 5s, or Stopped: used more than 1 GB.

The time limit’s card: the Run was busy for 5s without a pause.
The memory limit’s card: the Run used more than 1 GB.

In the Timeline, a Run stopped by the time limit reads Stopped after 5s. For a Trace that ran out of Steps, see What is not recorded.

Run longer or with more memory JSpark+

The card’s button runs the Snippet again, once, with more:

  • Run longer gives it four times the time limit, up to 10 s.
  • Run with more memory gives it twice the memory limit, up to 8 GB.

This is for that Run only. To give every Run more, raise the limit in Settings → Running. When a Run that already had more memory is stopped again, the card has no button and asks you to raise the limit in Settings.

Run longer lets the search finish; then the Time limit is raised to 10s for every Run.

In JSpark, the buttons are on the card too. Pressing one says what JSpark+ adds, and runs nothing.

The pictures show JSpark on a Mac. On Windows, the window looks a little different and uses Ctrl for ⌘, but everything works the same way.

Esc

Type to search every docs page.