How can I free memory allocated when deserializing with boost::archive::text_iarchive
Hi, Does anyone know how we can free memory that is dynamically allocated by boost::archive::text_iarchive when deserializing an archive? We have tried using 'delete' and free() on the pointer when we finish with it, but it results in a crash. How does Boost dynamically allocate memory, 'new', 'malloc', or other? We tried a shared_ptr, but were getting compile errors related to the include files, and have not gone back to track that down. So if there is a simple way to free the memory that would be best for our application. Thanks, Adlai Shawareb Vytronus, Inc.
On 2013-02-04 14:46, Adlai Shawareb wrote:
Hi,
Does anyone know how we can free memory that is dynamically allocated by boost::archive::text_iarchive when deserializing an archive?
We have tried using 'delete' and free() on the pointer when we finish with it, but it results in a crash.
How does Boost dynamically allocate memory, 'new', 'malloc', or other?
We tried a shared_ptr, but were getting compile errors related to the include files, and have not gone back to track that down. So if there is a simple way to free the memory that would be best for our application.
Thanks,
Adlai Shawareb
Vytronus, Inc.
The memory allocation is described here: http://www.boost.org/doc/libs/1_52_0/libs/serialization/doc/serialization.ht... I have no problem calling delete on any pointer to a object constructed when deserializing an archive. Nor have I had any problem deserializing to a shared_ptr or other smart pointer types. Perhaps you could provide a small self-contained example demonstrating your problem ?? Tim
participants (2)
-
Adlai Shawareb
-
Tim Moore