Reputation: 9527
I have an application in C++ that process data. Lets say:
download dataA - run app to process A
download dataB - run app to process B
...
Now I need in B run to have acces to data generated by A. I can store them in a temporary file or DB, but it slows things down. Is there a way how to preserve output from A in memory and open it again in B?
I can not download data and then run the app, it is a serial processing.
Upvotes: 1
Views: 196
Reputation: 1209
This can be done using with shared memory. It depends on your operating system.
If you are using Windows: https://msdn.microsoft.com/en-us/library/windows/desktop/aa366551(v=vs.85).aspx
If you are using Linux: https://beej.us/guide/bgipc/output/html/multipage/mmap.html
But there is another option, using Boost.Interprocess facility: http://www.boost.org/doc/libs/1_60_0/doc/html/interprocess/sharedmemorybetweenprocesses.html
Upvotes: 1
Reputation: 3365
It depends on the OS. On Linux you can store the data in shared memory, which is persistent even if no applications are using it. On Windows there is also shared memory, but it will be automatically reclaimed if no applications are using it, so once program A ends, the data will be lost.
Upvotes: 1