mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 03:54:01 +00:00
src/runtime: use memzero for leaking collector
This commit is contained in:
@@ -29,11 +29,9 @@ func alloc(size uintptr, layout unsafe.Pointer) unsafe.Pointer {
|
|||||||
// Failed to make the heap bigger, so we must really be out of memory.
|
// Failed to make the heap bigger, so we must really be out of memory.
|
||||||
runtimePanic("out of memory")
|
runtimePanic("out of memory")
|
||||||
}
|
}
|
||||||
for i := uintptr(0); i < uintptr(size); i += 4 {
|
pointer := unsafe.Pointer(addr)
|
||||||
ptr := (*uint32)(unsafe.Pointer(addr + i))
|
memzero(pointer, size)
|
||||||
*ptr = 0
|
return pointer
|
||||||
}
|
|
||||||
return unsafe.Pointer(addr)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func realloc(ptr unsafe.Pointer, size uintptr) unsafe.Pointer {
|
func realloc(ptr unsafe.Pointer, size uintptr) unsafe.Pointer {
|
||||||
|
|||||||
Reference in New Issue
Block a user