You may be hitting memory fragmentation if you're running a 32-bit OS. It is very possible to reach a point where you can't even allocate a couple of megabytes because every possible virtual address is filled with something.
This is especially bad with languages that use a lot of threads like Java, .NET or Go. Each thread gets its own stack which is placed somewhere that it can grow if it needs to.
And combined with ASLR for security randomization, 32-bit memory gets fragmented very quickly.
You could also be hitting the maximum map count. This even affects 64-bit systems but I haven't seen it happen with Go. Rust hits it a lot. Linux defaults this to 64k maps. I've increased it on my Linux systems:
$ cat /etc/sysctl.d/20-max-maps.conf vm.max_map_count = 262144