Boost logo

Boost :

From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2006-01-31 01:03:42


Hi Pedro,

> I suggest supplying a default constructor to the shared memory Allocator
> (and generally making it compatible with the Allocator concept) in order
> to allow the easiest uses, like:
>
> std::queue<boost::shmem::allocator> global_queue;

But since a shared memory segment is dynamic (and because of that, the
address is not known at compile time) how can the allocator know the
address of the segment from where it has to allocate memory? Also, if
the user opens more than one segment, you must say from which segment
you want to allocate memory. If you have only one segment you could use
a static object to tell so. This is a bit different from "operator new",
because there is just one standard heap source and you don't need any
handle to call global new. When allocating from shared memory, and since
you can have multiple segment, you need dynamic data. But if you have
any idea to initialize the allocator you think it's better than the
current approach, I'm open to include it in Shmem.

Regards,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk