[pulseaudio-discuss] PulseAudio does not start with "lock-memory = yes" at boot

Roman Beslik rabeslik at gmail.com
Thu Jan 12 20:52:11 PST 2012


Hello.
I'm using ArchLinux. It runs "/etc/rc.local" at boot. If I start 
PulseAudio with "lock-memory = yes" in "/etc/rc.local" with the line
{{{
sudo -u user env HOME=/home/user pulseaudio &
}}}
it yields an error:
{{{
shm.c: mmap() failed: Resource temporarily unavailable
core.c: failed to allocate shared memory pool. Falling back to a normal 
memory pool.
shm.c: mmap() failed: Resource temporarily unavailable
core.c: pa_mempool_new() failed.
main.c: pa_core_new() failed.
}}}
But PulseAudio starts smoothly with the same configuration if I start it 
from "bash".

I tried to narrow a problem. My test program below runs smoothly from 
"/etc/rc.local" and from "bash". What else can I test?
{{{
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/mman.h>
#ifndef _POSIX_MEMLOCK
#error we need the function "mlockall"
#endif

int main (int argc, char **argv) {
     char *p;
     int n;
     int i;
     n = 1<<26;
     mlockall(MCL_CURRENT | MCL_FUTURE);
     p = mmap(NULL, n, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, 
-1, (off_t) 0);
     if (p == MAP_FAILED) {
         printf("error while allocating\n");
         return (220);
     } else {
         printf("%d bytes were allocated\n", n);
         for (i=n; i-->0;) {
             p[i] = 9;
         }
         return (0);
     }
}
}}}


More information about the pulseaudio-discuss mailing list