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 7524749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T03:08:51+00:00 2026-05-30T03:08:51+00:00

I would like to pre-allocate sufficiently large amount of memory in a program before

  • 0

I would like to pre-allocate sufficiently large amount of memory in a program before forking processes and then further allocate/use memory from this pool in the forked processes. I have come across some memory allocators like Bget, Boost etc but not able to understand how to use them.

Is there a simplest one out there which I can use like

poolhandle = poolallocate(pool_size)

Then in forked process use something like

ptr = allocatefromPool(poolhandle,no_of_bytes)

and then if I pass this pointer to another process through some IPC it should be accessible even in that process.

Can you point me in right direction ? If Boost is the way to go can you provide me an example on how to use it ?

  • 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-05-30T03:08:53+00:00Added an answer on May 30, 2026 at 3:08 am

    Honestly, the easiest way to do this is to use a memory-mapped file. Then you just do seek and write to save things, or seek and read to get things.

    Beyond that, there is always the concept of actors where you don’t share any memory at all, just send messages between actors, each of whom is the curator of their own datastore. This is simpler to program, especially with tools like ZeroMQ that make the interprocess and interthread messaging so simple.

    If you combine the two ideas then each actor process has an area of the memory mapped file which they own, and you pass messages back and forth to tell them what to read or write.

    See this question for more on memory-mapped files as shared memory Posix shared memory vs mapped files

    Here is one about IPC which you will need for multiple processes to coordinate actions IPC vs domain sock vs named pipes

    If you have large blocks of data to move around in messages then you would probably want to leave the data in place in the memory-mapped file and implement some form of lock-free sharing. There is lots of stuff you can Google using the keyword lock-free in conjunction with “shared memory” or “data structures”.

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

Sidebar

Related Questions

I have my pre generated AES key what i would like to use in
I would like to use a post/pre-commit hook to fill the fixed bug field
I would like to use the constructor on the ExecutorCompletionService which takes a pre-defined
I would like to pre-populate a UITextfield with the phone number of the current
I'm writing a pre-commit hook, and would like to do a check on the
Can you mix .net languages within a single project? So pre-compiled, I would like
I would like to do a batch put of entities with pre-defined keys using
I would like to start an application from a pre-build step. However, I do
I am new to Android development and would like to select data and pre-populate
I would like to create a struct and use it inside an other struct

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.