std::Map of int and struct running out of memory (std::Bad_alloc) c++
<p>I have the following in my program</p>

<pre><code>class memModel
{
    struct Addrlist
    {
        vector&lt;string&gt; data;
        vector&lt;int&gt; timestamp;
        vector&lt;string&gt; client;
    }

    map&lt;int, Addrlist&gt; AddrMap ; //store based address and list of all accesses
}
</code></pre>

<p>In main() I read from a few files and store millions of entries into this stuct</p>

<pre><code>int main()
{
    memModel newObj ;
    ifstream file1("dataStream");
    ifstream file2("timeStampSteam");
    ifstream file3("clientStream");
    ifstream file4("addrStream") ; 
    string dataSTR,clientSTR;
    int time = 0 ; 
    int addr;
    for(int i=0; i&lt;10000000/*10mil*/ ; i++)
    {
        getline(file1,dataSTR);
        getline(file3,clientSTR);
        file2 &gt;&gt; time ; 
        file4 &gt;&gt; hex &gt;&gt; addr ; 

        newObj.AddrMap[addr].data.push_back(dataSTR) ; 
        newObj.AddrMap[addr].time.push_back( time) ;
        newObj.AddrMap[addr].client.push_back(clientSTR) ;
    }      

  }    
</code></pre>

<p>So the problem is I am running out of memory and get the std::Bad_alloc exception. This code works with smaller data sizes.</p>

<p>I am trying to understand where the struct and Map are being stored. Is everything going on the Stack ? 
The vectors are dynamically allocated right. Are those going to the heap ?</p>

<p>This is my first time working with large data sets so I would like to understand the concepts better. How can I change this to make sure I am using the heap and I do not run out of memory. </p>