|
Boost Users : |
Subject: [Boost-users] FW: Does the boost library free the memory occupied by the vector automatically when I call erase method provided by list class?
From: Gordon HUYUE (huyuevip_at_[hidden])
Date: 2012-07-03 06:13:29
From: huyuevip_at_[hidden]
To: boost-users_at_[hidden]
Subject: Does the boost library free the memory occupied by the vector automatically when I call erase method provided by list class?
Date: Tue, 3 Jul 2012 10:03:34 +0000
Hi all,
Currently I am using "boost/interprocess" to manage shared memory between parent process and child process, the OS is AIX 6.1. The boost library is really cool and it works well, but I still have something to worry about, because the program is server side application and should be available 24/7.
I apply memory at the beginning of the program, the size of memory is big enough; I use a list object provided by boost, the element type of the list object is a request object, the request object has a member with property of vector, Here is my concern:
Does the boost library free the memory occupied by the vector automatically when I call erase method provided by list class? if it does not , the memory will be run out soon, because the program will add and delete object from list frequently. I'd like to make sure whether the boost library can deal with it. If it cann't, Is there any other solutions?
some tips when reading demo file
Line 55: definition of RequestObject
Line 67: this is a member variable inside RequestObject
interfaceobject_vector myvector;
Line 79: definition of List, the element of this List is RequestObject
Line 139: we add a request object into list.
myRequestObjectList->push_front(*myRequestObject);
Line 268: we delete a request objest from list, in this case , Does boost library free the memory occupied by myvector(which is a member variable inside RequestObject) automatically?
myRequestObjectList->erase(myIterator);
The file attached is a demo cpp, I hope it will be helpful for everybody to understand my question easily. If we add InterfaceObject_sh object into myvector when initializing, and add request object(which include myvector) into list, finally we call erase methed provided by list, Does boost library free the memory occupied by myvector automatically?
Best Regards,
Gordon
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net