![]() |
Boost : |
From: Murali Kishore (bmuralikishore_at_[hidden])
Date: 2025-02-26 15:54:55
Thanks, I'll check it out.
On Wed, Feb 26, 2025 at 8:05â¯PM Marshall Clow <mclow.lists_at_[hidden]> wrote:
> On Feb 25, 2025, at 10:33â¯PM, Murali Kishore via Boost <
> boost_at_[hidden]> wrote:
> >
> > Hi,
> >
> > map and vector stored in shared memory using boost apis and called clear
> to
> > release memory. when i insert same key i see old data present. want to
> > check using boost map.clear or vec.clear is not removing content.
> >
> > Example:
> >
> > pod_list[] (vector contains following 3 members)
> > pod_info {
> >
> > pod_id
> > du_map.
> > cell_map.
> >
> > }
> >
> > Step 1: Added elements
> >
> > Step 2: pod_list.clear();
> >
> > Step 3: observed no elements in pod_list empty
> >
> > Step 4: Added only key
> >
> > pod_info.pod_id = 1;
> >
> > pod_list.insert(pod_info);
> >
> > Step 5: i see old content map to this pod_id. after this expecting
> > du_map.size and cell_map size is empty. but du_map,cell_map content is
> same
> > as before clear
> >
> > want to check is clear will not remove memory? is any other best way to
> > clean this vector.
>
> vector::clear() does not free memory allocated by the vector to store
> objects; it calls destructors for the objects it holds.
>
> See this stack overflow post (from 2012)
>
> https://stackoverflow.com/questions/10464992/c-delete-vector-objects-free-memory
>
> â Marshall
>
>
-- Regards, Murali Kishore
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk