<div dir="ltr">This error has nothing to do with MPI.<br><br>These two lines are the problem:<br><br>std::vector<std::vector<double> > a(100);<br>a[i].resize(1000000000);<div><br></div><div>You are trying to allocate 1e9 std::vector<double>, which I assume is many gigabytes of memory.</div><div><br></div><div>Jeff<br><br><br>On Wed, Apr 3, 2019 at 8:58 AM Zhou, Hui via discuss <<a href="mailto:discuss@mpich.org">discuss@mpich.org</a>> wrote:<br>><br>> I just tested on my Mac, the system keep popping out message asking me to force kill some application to free up memory, but the code never crashed, just stalled. So I guess the out-of-memory behavior is operating system dependent. My guess is when you have multiple process competing for memory, it may cause some race issue in the os that the OS  returns a valid address but discover out-of memory later because the memory is stolen by another process.<br>>  <br>> — <br>> Hui Zhou<br>> T: 630-252-3430<br>><br>><br>><br>><br>><br>><br>><br>><br>> On Apr 3, 2019, at 8:42 AM, Zhen Wang via discuss <<a href="mailto:discuss@mpich.org">discuss@mpich.org</a>> wrote:<br>><br>> Hi,<br>><br>> I have difficulty catching std::bac_alloc in an MPI environment. The code is attached. I'm uisng gcc 6.3 on SUSE Linux Enterprise Server 11 (x86_64). mpich is built from source. The commands are as follows:<br>><br>> Build<br>> g++ -I<mpich-3.3-opt/include> -L<mpich-3.3-opt/lib> -lmpi memory.cpp<br>><br>> Run<br>> <mpich-3.3-opt/bin/mpiexec> -n 2 a.out<br>><br>> Output<br>> 0<br>> 0<br>> 1<br>> 1<br>><br>> ===================================================================================<br>> =   BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES<br>> =   PID 16067 RUNNING AT <machine name><br>> =   EXIT CODE: 9<br>> =   CLEANING UP REMAINING PROCESSES<br>> =   YOU CAN IGNORE THE BELOW CLEANUP MESSAGES<br>> ===================================================================================<br>> YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Killed (signal 9)<br>> This typically refers to a problem with your application.<br>> Please see the FAQ page for debugging suggestions<br>><br>> If I uncomment the line //if (rank == 0), i.e., only rank 0 allocates memory, I'm able to catch bad_alloc as I expected. It seems that I am misunderstanding something. Could you please help? Thanks a lot.<br>><br>><br>> Best regards,<br>> Zhen<br>> <memory.cpp>_______________________________________________<br>> discuss mailing list     <a href="mailto:discuss@mpich.org">discuss@mpich.org</a><br>> To manage subscription options or unsubscribe:<br>> <a href="https://lists.mpich.org/mailman/listinfo/discuss">https://lists.mpich.org/mailman/listinfo/discuss</a><br>><br>><br>> _______________________________________________<br>> discuss mailing list     <a href="mailto:discuss@mpich.org">discuss@mpich.org</a><br>> To manage subscription options or unsubscribe:<br>> <a href="https://lists.mpich.org/mailman/listinfo/discuss">https://lists.mpich.org/mailman/listinfo/discuss</a><br><br><br><br>--<br>Jeff Hammond<br><a href="mailto:jeff.science@gmail.com">jeff.science@gmail.com</a><br><a href="http://jeffhammond.github.io/">http://jeffhammond.github.io/</a></div></div>