[Boost.Serialization] Memory management for references
Hi, I'm loading a class that requires a reference passed to the constructor. The implementation requires loading data into a pointer as explained in the docs. How is the memory for the loaded object handled? Does it automatically get freed when the object goes out of scope? Thanks -- sadrok@gmail.com Yahoo! IM: sadrok_za Jabber ID: sadrok@jabber.obsidian.co.za
sadrok wrote:
Hi,
I'm loading a class that requires a reference passed to the constructor. The implementation requires loading data into a pointer as explained in the docs. How is the memory for the loaded object handled? Does it automatically get freed when the object goes out of scope?
Nope, you have to manage it yourself. Look for delete_created pointers in the docs. Also, consider using shared_ptr for automatic storage managment. Serialization for shared_ptr is included with the library.
Thanks
participants (2)
-
Robert Ramey
-
sadrok