Boost C++ Libraries: Ticket #8683: windows native shared memory freeze when no more ram available https://svn.boost.org/trac10/ticket/8683 <p> Hi, </p> <p> I'm working with native windows shared memory and I have a problem when I'm running low on memory. </p> <p> If I have only 512Mb of Ram available and I create a window_shared_memory object with a size of 1Gb, the creation works well. But when trying to write inside the shared memory, the computer freezes, waiting for memory to be freed. </p> <p> Is there a way to avoid this freeze (I almost have to reboot my computer), or at least a way to throw an error when trying to write to memory we don't have ? </p> <p> Thanks. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/8683 Trac 1.4.3 anonymous Tue, 11 Jun 2013 07:05:53 GMT component changed; owner set https://svn.boost.org/trac10/ticket/8683#comment:1 https://svn.boost.org/trac10/ticket/8683#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Ion Gaztañaga</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">interprocess</span> </li> </ul> Ticket anonymous Tue, 11 Jun 2013 07:10:21 GMT <link>https://svn.boost.org/trac10/ticket/8683#comment:2 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8683#comment:2</guid> <description> <p> Just a precision (after reread it's not obvious), the freeze of the computer is probably because due to moving memory to swap (which is kind of normal). </p> <p> The freeze I don't want is my program waiting for memory to be freed. I want to be able to have the same behavior than with other objects which is to throw a <a class="missing wiki">MemoryError</a> exception when no more memory is available. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 20 Aug 2013 17:46:32 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/8683#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/8683#comment:3</guid> <description> <p> There is no way to detect your problem. When you use windows_shared_memory (and <a class="missing wiki">CreateFileMapping</a> win32 API), you are reserving memory that is backed by RAM plus the pagefile. When you start writing to the shared memory region, that memory must be in RAM so other programs and data must go to the pagefile to free RAM for your write. I don't know of any notification mechanism in windows to detect this behavior. </p> <p> You can try to map a portion of the file, write it and unmap it. Then you map a different portion. That could help windows to manage better the pagefile (as it only needs to care about the mapped region and not the whole shared memory object). </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Ion Gaztañaga</dc:creator> <pubDate>Sat, 07 Sep 2013 07:11:25 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/8683#comment:4 https://svn.boost.org/trac10/ticket/8683#comment:4 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">wontfix</span> </li> </ul> <p> I'm closing this as there is no solution for systems trashing on low memory conditions. I'm sorry. </p> Ticket