Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7937631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:34:10+00:00 2026-06-03T22:34:10+00:00

I try to do the following thing: Create a Big Array ( 1 000

  • 0

I try to do the following thing:

Create a “Big” Array ( 1 000 000 + Objects) into Shared memory with the boost::interprocess library

My Code contains the following:

managed_shared_memory testarray(create_only, "Test", 45000000);

typedef std::pair<SingleField, uint32_t> TestType;
TestType * test = testarray.construct<TestType>("TestArray")[45000000];

My question is: How do I figure out what the return type of this boost function is?

If i do the same above with the following : SingleField instead of “::pair it doesn’t seems to work, but i dont need a second container, i only need one but with one it doesn’t work!

The output of eclipse is somehow too cryptic for me. Since I work with boost I have been stopped several times because of such issues, is there an easy way to figure out what “Type” the function will give back? (I come from Java so I’ am used to have some “Simple” definition which says Object x ) i would actually be happy if I could figure out the type which a specific function returns, with all the functions I write for myself this is simple but with this library I seem to have issues.

Second question: Why are those examples always with “type” pair, is it a library pre-condition?

-> I have tried using #include , Eclipse tells me its std::pair The question is why is it T* ? Is this the starting segment address?

Thanks for your time & answers.

Eclipse output:

Multiple markers at this line
- unused variable test
- cannot convert const 
 boost::interprocess::detail::named_proxy<boost::interprocess::segment_manager<char, 
 boost::interprocess::rbtree_best_fit<boost::interprocess::mutex_family, 
 boost::interprocess::offset_ptr<void>, 0ul>, boost::interprocess::iset_index>, Field, false> to 
 SharedMemoryInitializer::Create()::TestType* in initialization

I have read the boost Library manuals for several times, maybe i look at the wrong sites or pages and i would be pleased if you supply information which i miss.

http://www.boost.org/doc/libs/1_42_0/doc/html/interprocess/quick_guide.html#interprocess.quick_guide.qg_interprocess_container

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:34:11+00:00Added an answer on June 3, 2026 at 10:34 pm

    From my point of view, there are two major issues with your code:

    • you seem to be allocating 45000000 objects of type TestType which is probably not what you want (unless TestType only needs one byte per instance):

      TestType * test = testarray.construct<TestType>("TestArray")[45000000];

    • according to the documentation (*) you must provide provide parentheses for the constructor call (you are using the second version):
      TestType * test = testarray.construct<TestType>("TestArray")[45000000]();

      I assume that TestType has a parameter-less constructor.

    (*) http://www.boost.org/doc/libs/1_46_1/doc/html/interprocess/managed_memory_segments.html#interprocess.managed_memory_segments.managed_memory_segment_features.allocation_types

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use the following code try to create an array of string vectors, I
Try the following code: s = '#value#' puts s.gsub('#value#', Regexp.escape('*')) # => '\*' puts
I try the following code, but it doesn't work. [helloToolbar setBackgroundColor:[UIColor clearColor]];
We have following code: try { // some code throwing MyException } catch (MyException
If I try executing the following code f = file('test','rb') fout = file('test.out','wb') for
Whenever I try the following in my python interpreter. I am able to copy
I get the following error message when I try the following: Dim XL As
I need to serialize a Lucene.net Document instance. When I try the following public
Try executing the following in JavaScript: parseInt('01'); //equals 1 parseInt('02'); //equals 2 parseInt('03'); //equals
I am using the following to try and list all the files in a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.