diff --git a/internal/alloc/alloc_unix.go b/internal/alloc/alloc_unix.go index 009cc1f..c05cfa7 100644 --- a/internal/alloc/alloc_unix.go +++ b/internal/alloc/alloc_unix.go @@ -47,7 +47,7 @@ func (m *mmappedMemory) Reallocate(size uint64) []byte { // Commit additional memory up to new bytes. err := unix.Mprotect(m.buf[com:new], unix.PROT_READ|unix.PROT_WRITE) if err != nil { - panic(err) + return nil } // Update committed memory. diff --git a/internal/alloc/alloc_windows.go b/internal/alloc/alloc_windows.go index 62d4996..46181b1 100644 --- a/internal/alloc/alloc_windows.go +++ b/internal/alloc/alloc_windows.go @@ -56,7 +56,7 @@ func (m *virtualMemory) Reallocate(size uint64) []byte { // Commit additional memory up to new bytes. _, err := windows.VirtualAlloc(m.addr, uintptr(new), windows.MEM_COMMIT, windows.PAGE_READWRITE) if err != nil { - panic(err) + return nil } // Update committed memory.