Why did I get a Segmentation Fault with a map insert
<p>I want to insert a  <code>pair&lt; string, vector&lt;float&gt; &gt;</code> into a map, first it works, but after several loops, it cannot insert any more and throw me a segmentation fault. Can anybody give a possible reason? </p>

<p>Btw: I first read a file and generate the map (about 200,000 elements) and I read another file and update the old map. the error occurs while the updating step.</p>

<p>Can anybody help me with the info I gave above? Thanks a lot</p>

<p>The code is pretty long.....I just erase the previous key and then insert a new one, it seems not complicated.....but drives me crazy....could you guess what happened here?</p>

<p>Thanks A lot for all your answers! And I found it is really a good place for solving problems. Thanks again, I'll try to simplify my codes and add it here today or tomorrow.</p>

<p>Update: I used the code from MSN and it works, thanks a lot that you solved my problem without seeing my code......also many thanks to other kind-hearted people here! However, i can only choose one as the answer.</p>
