Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

What can be stored in persistent memory?

memory persistent stored
0
Posted

What can be stored in persistent memory?

0

Almost all normal data types can be stored, including built-in data types (ints, floats, doubles, enums etc), structures and arrays. Pointers may also be stored, but they will only be valid if they point to data in the persistent heap. If they point to data outside the heap, guess what? They will probably be broken the next time the program is run. Objects created using the STL are also perfectly valid, provided they use the allocator persist::allocator. For example, #include “persist_stl.h” struct AppData { std::vector primes1; // Invalid, since the vector is not stored in persistent memory std::vector > primes2; // Okay persist::vector primes3; // Okay std::string name1; // Invalid, since the string body is not stored in persistent memory persist::string name2; // Okay }; persist::map_data app_data(“appdata.map”); Most of the common containers have been defined in to use persist::allocator.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123