pthread_create_problem

From: Franc Carter <franc_at_mml.usyd.edu.au>
Date: Thu, 23 Mar 2000 10:06:38 +1100

We are having a problem with pthread_create(). Thread
creation fails if we try to create a thread when we the
process is bigger than about 512M. The vm-mapentries
on the machine is set to 32768. The machine has 2GB
of ram.

An example piece of code that fails is below.

Any suggestions and/or an explanation of how vm-mapentries
affects the system would be appreicated.

thanks

======================================================

#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <pthread.h>

void *test (void *arg)
{
    return NULL;
}

int main ()
{
    pthread_t thread;
    int i;

    assert (malloc (512*1024*1024));
    i = pthread_create (&thread, NULL, test, NULL);

    if (i==ENOMEM) printf ("Out of memory\n");
    return i;
}

-- 
Franc Carter                            MEMLab, University of Sydney
Ph: 61-2-9351-7819                      Fax: 9351-6461
Received on Wed Mar 22 2000 - 23:22:31 NZST

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:40 NZDT