Boost logo

Boost Users :

Subject: [Boost-users] boost:interprocess sizeof(list<Type>::Node)
From: waterbed (gaston.azerty_at_[hidden])
Date: 2009-03-04 12:28:37


Hello,

My problem is really basic :
I have N objects of type Type to store in a boost::interprocess::list<Type>.
The question is easy : How many bytes should I provide to the
managed_mapped_file, in order it fits correctly?

So, I supposed I had to store (let's assume bi = boost::interprocess):
  + The list allocator : sizeof( bi::allocator<Type,
bi::managed_shared_memory::segment_manager> )
  + The struct of the list itself : sizeof( bi::list<Type,
bi::allocator<Type, ...> > )
  + The N nodes of the list containing each one of my objects : sizeof(
bi::list<Type, ...>::Node)

First issue : bi::list<Type, ...>::Node is private. Fine, I changed it as
public.
Second issue : sizeof(bi::list<Type, ...>::Node) was not enough, actually I
can't add N objets, I was just able to allocate (N - x) objets
Third issue : so I tried to fix the value of x, but x is not constant, it
changes according to N...

Thus I think, I made a mistake but where? or I forgot something but what?

Thank for your help and your advises.

-- 
View this message in context: http://www.nabble.com/boost%3Ainterprocess-sizeof%28list%3CType%3E%3A%3ANode%29-tp22334541p22334541.html
Sent from the Boost - Users mailing list archive at Nabble.com.

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