Libraries
bignum
binary
bitmap
ble
bytes
core
collections
comparable
entry
exceptions
finalization
numbers
objects
print
process
string
task
time
timer
utils
crypto
device
encoding
esp32
expect
fixed-point
flash
font
gpio
i2c
i2s
icons
io
line-wrap
log
math
monitor
net
pulse-counter
reader
reader-writer
rmt
serial
spi
statistics
system
tls
uart
uuid
writer
zlib
Library finalization
This is exported from the core library, which means you don't need to import it.
Support for finalization.
Functions
add-finalizer
object/
any
lambda/
any
->
none
Registers the given
lambda
as a finalizer for the
object
.
Calls the finalizer if all references to the object are lost. (See limitations below).
Errors
It is an error to assign a finalizer to a smi or an instance that already has a finalizer (see
remove-finalizer
).
It is also an error to assign null as a finalizer.
Warning
Misuse of this API can lead to undefined behavior that is hard to debug.
Advanced
Finalizers are not automatically called when a program exits. This is also true for objects that weren't reachable anymore before the program exited.
An arbitrary amount of time may pass from the
object
becomes unreachable and the finalizer is called.
remove-finalizer
object/
any
->
bool
Unregisters the finalizer registered for
object
.
Returns whether the object had a finalizer.