This is the mail archive of the pthreads-win32@sources.redhat.com mailing list for the pthreas-win32 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cleaning of memory in pthread_create


Hi,
This is regarding freeing of resource and cleaning of
memory allocated when "pthread_create" is called.
Most of my memory leaks tool says 'memory leak of 120
bytes allocated by calloc in "ptw32_new.c"'.
Is there any call that will free memory and resources?
Or there is some other way?

Regards

Pankaj


This is my sample code.


static int washere = 0;

void * func(void * arg)
{
  washere = 1;
  std::cout<<"Inside The THREAD "<<std::endl;
  return 0; 
}
 
int main()
{
  pthread_t t;

  assert(pthread_create(&t, NULL, func, NULL) == 0);

  /* A dirty hack, but we cannot rely on pthread_join
in this
     primitive test. */
  Sleep(2000);
  assert(washere == 1);
  std::cout<<"Out side the THREAD "<<std::endl;
  return 0;
}


__________________________________________________
Yahoo! - We Remember
9-11: A tribute to the more than 3,000 lives lost
http://dir.remember.yahoo.com/tribute


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]