<div class="markdown_content"><hr/>
<p><strong> <a class="alink" href="http://sourceforge.net/p/pure-data/patches/562/">[patches:#562]</a> fix crash with large arrays</strong></p>
<p><strong>Status:</strong> open<br/>
<strong>Group:</strong> bugfix<br/>
<strong>Labels:</strong> puredata crash array out-of-memory <br/>
<strong>Created:</strong> Mon Oct 05, 2015 06:05 PM UTC by IOhannes m zmölnig<br/>
<strong>Last Updated:</strong> Mon Oct 05, 2015 06:05 PM UTC<br/>
<strong>Owner:</strong> Miller Puckette<br/>
<strong>Attachments:</strong></p>
<ul>
<li><a class="" href="https://sourceforge.net/p/pure-data/patches/562/attachment/0001-check-if-array-was-resized-successfully.patch">0001-check-if-array-was-resized-successfully.patch</a> (1.2 kB; text/x-diff)</li>
</ul>
<p>when creating largish tables (e.g. <code>[table foo 1e9]</code> on my 64bit machine with only 8GB of RAM), Pd crashes.</p>
<p><code>resizebytes()</code> correctly reports out-of-memory, but unfortunately <code>array_resize()</code> ignores this and happily tries to initialize the 1st few gigabyte of memory starting at <code>0x0000</code>, resulting in a crash.</p>
<p>attached patch fixes this by cancelling the resize-request when an out-of-memory is detected.<br/>
(the array stays untouched in this case).</p>
<p>while this might not be what the user expects, a crash is certainly even less deisrable. (and at least it is possible to check the size of the array after a resize, so a patch stays consistent).</p>
<p>there are a few more unchecked calls to <code>resizebytes()</code> (and <code>getbytes()</code>), but i think it is easiest to get an out-of-memory with requesting huge arrays; so this is the most important use to fix.</p>
<hr/>
<p>Sent from sourceforge.net because pd-dev@lists.iem.at is subscribed to <a href="https://sourceforge.net/p/pure-data/patches/">https://sourceforge.net/p/pure-data/patches/</a></p>
<p>To unsubscribe from further messages, a project admin can change settings at <a href="https://sourceforge.net/p/pure-data/admin/patches/options.">https://sourceforge.net/p/pure-data/admin/patches/options.</a>  Or, if this is a mailing list, you can unsubscribe from the mailing list.</p></div>