Quoting Samuel Thibault (2015-02-24 01:04:19)
> I tried to start a gcc-5 build, it gets stuck at the tar x stage, with
> gnumach printing:
> 
> no more room for vm_map_find_entry in 80223e20 (kmem_map_store)
> no more room for kmem_realloc in 80223e20 (kmem_map_store)
>[...]
> ipc_port              0010      80   4k    50 262239 262350   20988k          
> 0k

kmem_realloc is only used to enlarge the ipc tables, but this is not
due to the lack of space, but due to the lack of a sufficiently large
continuous chunk of the kernel address space.

As demonstrated by the attached program the maximum number of ports a
task can have seems to be around 250000, which doesn't seem like a
lot.

% ./test
./test: mach_port_allocate (last good name: 242175): (os/kern) resource shortage

This suggests that we need a different data structure that doesn't
depend on a continuous chunk of memory.

Justus
#define _GNU_SOURCE
#include <assert.h>
#include <error.h>
#include <errno.h>
#include <mach.h>
#include <stdio.h>

int
main ()
{
  error_t err;
  mach_port_t name;
  while (1)
    {
      err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE,
				&name);
      if (err)
	error (1, err, "mach_port_allocate (last good name: %i)", (int) name);
    }
  return 0;
}

Reply via email to