I am working on a real-time application which uses Intel tbb 3 (tbb30_20100406). The application is infinitely consuming memory over time after increasing the load but there are no memory leaks as I've checked it with Valgrind. The application does hundreds of allocation and de-allocation every 0.5 seconds. After searching online, I came across a possibility of memory fragmentation, which can be reduced by creating a memory pool and allocating memory from it. And we can also set a soft heap limit for memory.

So I wanted to upgrade the tbb version and use these features. But as I compiled with the latest version it gave me the error " Parsing 'const SpliGroup as ' this argument of 'void SplitGroup::operator() ()' discards qualifiers [-fpermissive]".

The SplitGroup class has an operator()() in it.

The code is running fine with the previous version and giving errors in the new version. What has changed in this version which is causing the problem?

Could you please share the exact version (major, minor and update number) of the library you are trying to use? According to CHANGES file, starting from TBB 4.4 Update 1 user functors passed to task_group::run_and_wait() and task_arena::enqueue() must not be mutable. Thus, I strongly recommend to specify that "operator()()" does not modify the state of the object (i.e. add "const" in its declaration).

If you are unable to do this and still want to use the library version greater than 4.4U1, you can compile the code with __TBB_ALLOW_MUTABLE_FUNCTORS macro enabled.