|
Boost Users : |
Subject: Re: [Boost-users] multi_index_container assertion after crash
From: joaquin_at_[hidden]
Date: 2009-10-14 06:47:36
Eli Zakashansky escribió:
> Joaquín hi,
>
> First thanks for your response.
>
> The iterators I use are not persistent (I am retrieving the iterators
> from the index each time I am adding or removing element to/from the
> container). And even though the crash happens during massive use of
> the container, it does not happens in the middle of multi_index_container
> op (I have an applications log where I can see when exactly where in
> the code the app. crashes). I thought that may be the multi_index_container
> shall be flushed to the disk (it will effect performance) but I didnt
> find any method to do it.
>
> For more information I would like to tell you in general about the test
> I do:
> 1. at first I populate my multi_index_container with elements (~4000).
> 2. I invoke a process which removes elements from the container (and
> processing each element after its removal - this phase doesn't relate to
> any boost structure ).
> During stage # 2 I am killing the process via task manager.
>
Umm, maybe we're looking at the wrong area and this has nothing to do with
persistence. Consider the following piece of pseudocode:
multi_index_container<...> m;
auto it=m.find(...);
m.erase(it);
auto it2=it1; // WRONG
See the last line? Once you've deleted the element a given iterator points
at, this iterator becomes invalid and the only thing you can do with it
is assign it a new value --you can't copy it, use it as the right part of an
assignment, etc. If safe mode is on, assertions like the one you're seeing
will pop up. Maybe you're having such a problem in your code?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
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