Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Threads problems



Hi,
I am having "issues" with threads on darwin and memory consumption.

It seems that with every thread I create about 4k of resident memory is allocated. That memory never seems to be reclaimed at thread termination.

My little test program, which creates 100 threads at 5 second intervals is posted below.

Is there something fundamental that I'm missing?

Cheers,

Matt
-- Darwin dannii.hq.inty.net 7.8.0 Darwin Kernel Version 7.8.0

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

void mythread()
{
        printf("moo\n");
}

int main()
{
        int i;
        pthread_t q;
        for(i=0; i<100; i++)
        {
                pthread_create(&q,NULL,(void *)&mythread,NULL);
                sleep(5);
        }
        return(0);
}


Scanned for viruses by MailDefender _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.