mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-14 07:53:40 +00:00
runtime: check for heap allocations inside interrupts
This is unsafe and should never be done.
This commit is contained in:
committed by
Ron Evans
parent
e066e67baf
commit
f41b6a3b96
@@ -277,6 +277,10 @@ func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
|
||||
size += align(unsafe.Sizeof(layout))
|
||||
}
|
||||
|
||||
if interrupt.In() {
|
||||
runtimePanic("alloc in interrupt")
|
||||
}
|
||||
|
||||
gcTotalAlloc += uint64(size)
|
||||
gcMallocs++
|
||||
|
||||
|
||||
Reference in New Issue
Block a user