Boost logo

Boost :

Subject: [boost] [Function] : Memory allocation upon bind()
From: Harry van Haaren (harryhaaren_at_[hidden])
Date: 2013-01-14 18:52:26

Hi All,

Boost::bind() allocates memory on the heap.
In my situaion it is necessary to use manual memory pool instead of heap
to conform with real-time timing requirements. (no malloc() calls allowed
in real-time code)

A solution might be writing a custom allocator for the boost::bind()'s data,
and use a pre-allocated memory pool with the "placement" new( void* ) to
write directly into it.

I've found that there was a discussion on std::allocator support for
std::bind and std::function here:

I'm not very familiar with the internals of bind() and Function in general,
hence advice is appreciated.
What is the status of boost::bind() and custom allocators?
Is there a chance this could work?
Am I missing some "easy" workaround or solution?

Thanks for reading, -Harry

Boost list run by bdawes at, gregod at, cpdaniel at, john at