|
Boost Users : |
Subject: Re: [Boost-users] [Pool] questions
From: Tobias Columbus (t.columbus_at_[hidden])
Date: 2009-07-15 05:04:58
Pearl Rothman wrote:
> I am using Fedora 9, gcc 4.3.0, and boost 1.38.0.
>
> I am inheriting from object_pool so I have access to some of
> object_pool's hidden members.
>
> Is there a way for me to find out how many memory blocks or allocated
> chunks there are in the free list vs how many chunks are currently
> being used?
>
The protected interface is documented at
http://www.boost.org/doc/libs/1_38_0/libs/pool/doc/implementation/pool.html
To get all allocated blocks, you may iterate over
details::PODptr<size_type> list;
which is a list of all allocated memory blocks.
To get the free list, you may access the protected members of
simple_segregated_storage and iterate over the free list given by
void* first and the nextof( void* ) convenience function.
Perhaps there is a better way, but from the documentation that is the
first thing that comes to my mind.
> Is the object_pool thread safe?
>
singleton_pool and pool_alloc are thread safe, while object_pool is not.
> Does set_next_size have a permanent effect or will the double
> algorithm start being used after the next allocation? If it's a
> permanent effect, is there something I can call to start using the
> double algorithm again?
I am not sure, but you may write a simple test program via next_size and
set_next_size to check how set_next_size behaves.
Tobias
>
> Thanks
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users
>
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