From: Eric Wong Date: 2010-07-17T05:45:08+09:00 Subject: [ruby-core:31319] Re: [Bug #3566] memory leak when spawning+joining Threads in a loop Yusuke ENDOH wrote: > I'll commit the following patch instead of the previous one, because > the previous one seems to cause SEGV when running make test. (sorry!) > > diff --git a/thread_pthread.c b/thread_pthread.c > index e974b73..e832b82 100644 > --- a/thread_pthread.c > +++ b/thread_pthread.c > @@ -226,9 +226,7 @@ get_stack(void **addr, size_t *size) > # endif > CHECK_ERR(pthread_attr_getguardsize(&attr, &guard)); > *size -= guard; > -# ifndef HAVE_PTHREAD_GETATTR_NP > pthread_attr_destroy(&attr); > -# endif > #elif defined HAVE_PTHREAD_GET_STACKADDR_NP && defined > HAVE_PTHREAD_GET_STACKSIZE_NP > pthread_t th = pthread_self(); > *addr = pthread_get_stackaddr_np(th); Thanks Yusuke, this patch works great for me and is much easier to understand :) #ifdef blocks inside functions scare me :x -- Eric Wong