Encountered today a problem on one of the mail servers running dovecot that after upgrade wasn’t able to login using imap and dovecot only printed in to maillog that dovecot: imap-login: Cannot map anonymous memory. It seems that this error is produced if in the dovecot.conf file the login_process_size is set to too low value. The explanation and default for the value is:
# Set max. process size in megabytes. If you don't use # login_process_per_connection you might need to grow this. # login_process_size = 64
So what I did is that in the dovecot.conf file I uncommented the login_process_size line and increased it to 256:
# Set max. process size in megabytes. If you don't use # login_process_per_connection you might need to grow this. login_process_size = 256