How to fix «mmap() failed: [12] Cannot allocate memory» on a Composer command?

The official installation instruction is publicly available here: How to install a Mage2.PRO extension.