Hi all,
I think I have found an evil bug, but I am not a threading expert... can
someone please confirm that this simple program is correct:
-----
#include <stdlib.h>
#include <assert.h>
#include <unistd.h>
#include <pthread.h>
void* ThreadFn (void* threadid)
{
unsigned i;
for (i = 0; i < 10000000; i++) {
void* p = malloc (4096);
free (p);
}
pthread_exit(NULL);
}
int main (int argc, char *argv[])
{
pthread_t thread;
int rc = pthread_create (&thread, NULL, &ThreadFn, NULL);
assert (rc == 0);
ThreadFn (NULL);
sleep (1000000);
return 0;
}
-----
It runs just fine, even with GuardMalloc on. _However_, if I set the
MallocStackLogging env var to 1, then the app crashes, usually with both
threads in stack_logging_log_stack().
Could it be that MallocStackLogging ruins the thread-safety of malloc()
and free()?! Surely not...
Thanks!
--
____________________________________________________________
Sean McBride, B. Eng email@hidden
Rogue Research www.rogue-research.com
Mac Software Developer Montréal, Québec, Canada
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Mt-smp mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden