summaryrefslogtreecommitdiffstatshomepage
path: root/docs/reference/pyboard.py.rst
diff options
context:
space:
mode:
authorNeil Ludban <neil.ludban@mantiumai.com>2025-01-25 16:00:24 -0500
committerDamien George <damien@micropython.org>2025-02-11 12:44:48 +1100
commitb11ba39c57ef6dd4d5a865464229a2aede9c825e (patch)
tree358a2526795dcb5ab474393bfc8df8597c014511 /docs/reference/pyboard.py.rst
parent11c9656fad716d42a33e9f5bc65596300d141daa (diff)
downloadmicropython-b11ba39c57ef6dd4d5a865464229a2aede9c825e.tar.gz
micropython-b11ba39c57ef6dd4d5a865464229a2aede9c825e.zip
rp2/modules: Fix memory leak and logic bug in handling of _pio_funcs.
The `rp2` package use a global dict `_pio_funcs` to populate a namespace for `@asm_pio` functions to be executed in. That dict is not cleaned up after use, keeping references to bound methods of a `PIOASMEmit`. By not setting/clearing all the functions, `asm_pio_encode` unintentionally allows the use of the old directives (harmless) as well as `jmp` (in general, produces the wrong output). Fix that by making sure `_pio_funcs` is returned to its original state after using it: - For `@asm_pio` update the target dict from `_pio_funcs` and then set additional functions as needed, leaving `_pio_funcs` unchanged. - For `asm_pio_encode`, borrow `_pio_funcs` to use as globals (avoiding a bunch of memory alloc/free) but delete the instruction entries after use. Signed-off-by: Neil Ludban <neil.ludban@gmail.com>
Diffstat (limited to 'docs/reference/pyboard.py.rst')
0 files changed, 0 insertions, 0 deletions