The allocator comes with an example of how to implement
it. Download it, unpack it and see main.cc.
This particular allocator is compatible with the Standard
Template Libary (STL) from stlport. It allows you to
easily allocate vector, list, set, map, etc container elements
in shared memory so that two or more processes can
access the same elements within the container classes.
The class keeps track of shared memory allocation and
recycles and deallocates memory as required.
See Bjarne Stroustrups 3rd Edition Section 19.4 for more
info.
Its good for applications which use shared memory,
multi-processed applications.
marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Section 19.4 of Bjarne Stroustrups 3rd Edition is really too long to
quote here, and should be considered a good pre-requisite to anyone
interested in working with allocators.
The section starts this way, however.
"An allocator is used to insulate implementers of algorithms and
containers that must allocate memory from the details of physical
memory. An allocator provides standard ways of allocating and
deallocating memory and standard names of types used as pointers and
references. Like an iterator, an allocator is a pure abstraction.
Any type that behaves like an allocator is an allocator.
The standard library provides a standard allocator intended to serve
most users of a given implementation well. In addition, users can
provide allocators that represent alternative views of memory. For
example, we can write allocators that use shared memory,
garbage-collected memory, memory from preallocated pools of objects,
etc.
The standard containers and algorithms obtain and access memory
through the facilities provided by an allocator. Thus, by providing a
new allocator we provide the standard containers with a way of using a
new and different kind of memory..." Section 19.4 of Bjarne
Stroustrup's 3rd Edition
My main use of this allocator is to provide the standard containers
which I use, like vector, map, etc., with access to a shared memory
pool. So the container contents are allocated in shared memory and
separate processes all have access to the same shared vector contents.
Same holds true for maps, sets, etc. Using semaphores, two or more
processes can efficiently and succintly exchange data with each other.
marc
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
...how do you use this, and what benifit does it give you?
The allocator comes with an example of how to implement
it. Download it, unpack it and see main.cc.
This particular allocator is compatible with the Standard
Template Libary (STL) from stlport. It allows you to
easily allocate vector, list, set, map, etc container elements
in shared memory so that two or more processes can
access the same elements within the container classes.
The class keeps track of shared memory allocation and
recycles and deallocates memory as required.
See Bjarne Stroustrups 3rd Edition Section 19.4 for more
info.
Its good for applications which use shared memory,
multi-processed applications.
marc
It would be good if you could quote or resume
"Bjarne Stroustrups 3rd Edition Section 19.4"
since it's not everyone who bougth that book.
Fred.
Section 19.4 of Bjarne Stroustrups 3rd Edition is really too long to
quote here, and should be considered a good pre-requisite to anyone
interested in working with allocators.
The section starts this way, however.
"An allocator is used to insulate implementers of algorithms and
containers that must allocate memory from the details of physical
memory. An allocator provides standard ways of allocating and
deallocating memory and standard names of types used as pointers and
references. Like an iterator, an allocator is a pure abstraction.
Any type that behaves like an allocator is an allocator.
The standard library provides a standard allocator intended to serve
most users of a given implementation well. In addition, users can
provide allocators that represent alternative views of memory. For
example, we can write allocators that use shared memory,
garbage-collected memory, memory from preallocated pools of objects,
etc.
The standard containers and algorithms obtain and access memory
through the facilities provided by an allocator. Thus, by providing a
new allocator we provide the standard containers with a way of using a
new and different kind of memory..." Section 19.4 of Bjarne
Stroustrup's 3rd Edition
My main use of this allocator is to provide the standard containers
which I use, like vector, map, etc., with access to a shared memory
pool. So the container contents are allocated in shared memory and
separate processes all have access to the same shared vector contents.
Same holds true for maps, sets, etc. Using semaphores, two or more
processes can efficiently and succintly exchange data with each other.
marc