mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-11 14:33:41 +00:00
runtime: add "end of heap" to detect out of memory
This can be used in the future to trigger garbage collection. For now, it provides a more useful error message in case the heap is completely filled up.
This commit is contained in:
@@ -14,7 +14,10 @@ func _Cfunc_clock_gettime(clk_id uint, ts *timespec)
|
||||
|
||||
const heapSize = 1 * 1024 * 1024 // 1MB to start
|
||||
|
||||
var heapStart = uintptr(_Cfunc_malloc(heapSize))
|
||||
var (
|
||||
heapStart = uintptr(_Cfunc_malloc(heapSize))
|
||||
heapEnd = heapStart + heapSize
|
||||
)
|
||||
|
||||
type timeUnit int64
|
||||
|
||||
|
||||
Reference in New Issue
Block a user