<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
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.
<div class=""> <br class="">
<div class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div dir="auto" style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
— </div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
Hui Zhou</div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
T: 630-252-3430</div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;">
<br class="">
</div>
<div style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">
<br class="">
</div>
<br class="Apple-interchange-newline">
</div>
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
</div>
<br class="Apple-interchange-newline">
<br class="Apple-interchange-newline">
</div>
<div><br class="">
<blockquote type="cite" class="">
<div class="">On Apr 3, 2019, at 8:42 AM, Zhen Wang via discuss <<a href="mailto:discuss@mpich.org" class="">discuss@mpich.org</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">
<div dir="ltr" class="">
<div class="">Hi,</div>
<div class=""><br class="">
</div>
<div class="">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:</div>
<div class=""><br class="">
</div>
<div class=""><b class="">Build</b></div>
<div class=""><font face="monospace, monospace" class="">g++ -I<mpich-3.3-opt/include> -L<mpich-3.3-opt/lib> -lmpi memory.cpp</font></div>
<div class=""><br class="">
</div>
<div class=""><b class="">Run</b></div>
<div class="">
<div class=""><font face="monospace, monospace" class=""><mpich-3.3-opt/bin/mpiexec> -n 2 a.out</font></div>
</div>
<div class=""><br class="">
</div>
<div class=""><b class="">Output</b></div>
<div class="">
<div class=""><font face="monospace, monospace" class="">0</font></div>
<div class=""><font face="monospace, monospace" class="">0</font></div>
<div class=""><font face="monospace, monospace" class="">1</font></div>
<div class=""><font face="monospace, monospace" class="">1</font></div>
<div class=""><font face="monospace, monospace" class=""><br class="">
</font></div>
<div class=""><font face="monospace, monospace" class="">===================================================================================</font></div>
<div class=""><font face="monospace, monospace" class="">= BAD TERMINATION OF ONE OF YOUR APPLICATION PROCESSES</font></div>
<div class=""><font face="monospace, monospace" class="">= PID 16067 RUNNING AT <machine name></font></div>
<div class=""><font face="monospace, monospace" class="">= EXIT CODE: 9</font></div>
<div class=""><font face="monospace, monospace" class="">= CLEANING UP REMAINING PROCESSES</font></div>
<div class=""><font face="monospace, monospace" class="">= YOU CAN IGNORE THE BELOW CLEANUP MESSAGES</font></div>
<div class=""><font face="monospace, monospace" class="">===================================================================================</font></div>
<div class=""><font face="monospace, monospace" class="">YOUR APPLICATION TERMINATED WITH THE EXIT STRING: Killed (signal 9)</font></div>
<div class=""><font face="monospace, monospace" class="">This typically refers to a problem with your application.</font></div>
<div class=""><font face="monospace, monospace" class="">Please see the FAQ page for debugging suggestions</font></div>
</div>
<div class=""><br class="">
</div>
<div class="">
<div class="">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.</div>
</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">
<div dir="ltr" class="gmail_signature">
<div dir="ltr" class="">Best regards,
<div class="">Zhen</div>
</div>
</div>
</div>
</div>
</div>
<span id="cid:f_ju19dx090"><memory.cpp></span>_______________________________________________<br class="">
discuss mailing list <a href="mailto:discuss@mpich.org" class="">discuss@mpich.org</a><br class="">
To manage subscription options or unsubscribe:<br class="">
<a href="https://lists.mpich.org/mailman/listinfo/discuss" class="">https://lists.mpich.org/mailman/listinfo/discuss</a><br class="">
</div>
</blockquote>
</div>
<br class="">
</div>
</body>
</html>