Boost logo

Boost Users :

From: Sudhir Parikh (sparikh_at_[hidden])
Date: 2007-05-31 18:41:50


BoundsChecker is reporting a memory leak for every 'bind' call. I am
using the threadpool includes, v 0.2.3, with
"libboost_thread-vc71-mt-gd-1_33_1.lib", MSVC 7.1. Any help is
appreciated.

 

The usage is similar to the following working example:

void task(int param1)

{

      // performs some task

      printf("%d : Param1 : %d\n", GetCurrentThreadId(), param1);

      Sleep(1000);

}

 

void foo()

{

      boost::threadpool::pool tp(5); // Threadpool with 5 threads

 

    while (1)

      {

            for (int i = 0; i < 10; i++)

            {

                  // Seems like there is memory allocation which is not

                  // deallocated after returning from the function call.

                  tp.schedule(boost::bind(task, i));

            }

 

            tp.wait(); // wait to finish off the remaining tasks

 

            Sleep(5000); // sleep for 5 seconds

      }

}

 



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net