bad alloc c++ loading file in matrix : <p>I try to load a large file (20gb) and load it into a matrix. However I get a bad_alloc error when it tries to load the file in the matrix. My code is working on Mac but doesn't on Linux. </p>

<p>Here is my code: </p>

<pre><code>std::ifstream ifs(filename, std::ifstream::binary);

loadModel(ifs);

void loadModel(std::istream&amp; in) {
     input_ = std::make_shared&lt;Matrix&gt;();
     input_-&gt;load(in); // bad_alloc
}
</code></pre>
