I had the same issue compiling a 5.15.36 kernel on Ubuntu 22.04, initrd.img (.tmp) below was causing Out of memory:
-rw-r--r-- 1 root root 13628696 May 23 22:58 initrd.img-5.15.36+
-rw-r--r-- 1 root root 515731970 May 23 22:58 initrd.img-5.15.36+.tmp
Switching MODULES=most (which produced .tmp above) to MODULES=dep in /etc/initramfs-tools/initramfs.conf produced the smaller initrd.img, and fixed the issue.
I had the same issue compiling a 5.15.36 kernel on Ubuntu 22.04, initrd.img (.tmp) below was causing Out of memory:
-rw-r--r-- 1 root root 13628696 May 23 22:58 initrd.img-5.15.36+ img-5.15. 36+.tmp
-rw-r--r-- 1 root root 515731970 May 23 22:58 initrd.
Switching MODULES=most (which produced .tmp above) to MODULES=dep in /etc/initramfs- tools/initramfs .conf produced the smaller initrd.img, and fixed the issue.
$ cat /proc/meminfo
MemTotal: 16065036 kB
...