Federico, Your diagnosis is correct, that freeze can be the result of reaching the limit for UVM amap allocations. These get used by the kernel to describe anonymous memory mappings, and mmap malloc() puts the UVM subsystem under a higher load of those, eventually reaching the limit. Until an appropriate solution is found, you can try bumping the number of pages in the kernel's memory map (NKMEMPAGES).
-p.