On Sun, Oct 18, 2020 at 1:24 PM robert engels <reng...@ix.netcom.com> wrote: > > If I set a low process memory limit, and then the OS refuses to grant more > memory to a malloc request,. will the Go runtime “stop the world” and attempt > a full garbage collection and try to get the memory from the heap and then > only crashing the process if it can’t? > > I understand that the “pacing” should limit (eliminate?) this situation, but > I am thinking in cases when the heuristics don’t match the immediate > allocations it would be beneficial.
It does not work that way today, no. The current Go memory allocator allocates address space and then expects that address space to be available. Typical GNU/Linux systems use overcommit, so there is often no system call reporting that memory could not be obtained; instead, there is a SIGBUS signal when the program first writes to a page that the kernel can no longer supply. It might be tricky to safely run a garbage collection and then retry the write. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcVLtwegxAONSqfNreBhB7tz9nOo1PfALN2OsXaZOdEoHA%40mail.gmail.com.