microsoft / microsoft/pxt-microbit

Recording Extension: "record" block in a tight loop panics out-of-memory

Open
#5,284 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

P2 record reliability
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

Describe the bug

Having the [record audio clip] block in a tight look results in an out of memory error after a couple of seconds.
Assuming that the recording extension and/or CODAL layer reuses buffers, or destroys and recreates them, then we probably shouldn't be hitting this issue?

image

To Reproduce
Steps to reproduce the behavior:

  1. Add recording extension
  2. Add the code below
  3. Flash to a micro:bit V2.x
  4. Panic with error 022 is thrown in a couple of seconds from startup.
basic.showIcon(IconNames.Heart)
while (true) {
    record.startRecording(record.BlockingState.Nonblocking)
}

Expected behavior
Not to run out of memory.

Screenshots
Already added.

micro:bit version (please complete the following information):

V2.x

Desktop (please complete the following information):
N/A

Smartphone (please complete the following information):
N/A

Additional context

makecode.microbit.org version: 6.0.10
Microsoft MakeCode version: 9.0.7
microbit runtime version: v2.2.0-rc6
codal-microbit-v2 runtime version: v0.2.55

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.

Research direction

Reproduce the issue on a micro:bit V2.x using the recording extension and the shown tight loop, starting at record.startRecording(record.BlockingState.Nonblocking). Inspect the recording extension and CODAL layer for buffer reuse or repeated allocation. Done means the loop no longer reaches panic error 022 or runs out of memory.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
embedded-iot
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.