[PD-dev] [pure-data:patches] #562 fix crash with large arrays
IOhannes m zmölnig
zmoelnig at users.sf.net
Mon Oct 5 20:05:57 CEST 2015
---
** [patches:#562] fix crash with large arrays**
**Status:** open
**Group:** bugfix
**Labels:** puredata crash array out-of-memory
**Created:** Mon Oct 05, 2015 06:05 PM UTC by IOhannes m zmölnig
**Last Updated:** Mon Oct 05, 2015 06:05 PM UTC
**Owner:** Miller Puckette
**Attachments:**
- [0001-check-if-array-was-resized-successfully.patch](https://sourceforge.net/p/pure-data/patches/562/attachment/0001-check-if-array-was-resized-successfully.patch) (1.2 kB; text/x-diff)
when creating largish tables (e.g. `[table foo 1e9]` on my 64bit machine with only 8GB of RAM), Pd crashes.
`resizebytes()` correctly reports out-of-memory, but unfortunately `array_resize()` ignores this and happily tries to initialize the 1st few gigabyte of memory starting at `0x0000`, resulting in a crash.
attached patch fixes this by cancelling the resize-request when an out-of-memory is detected.
(the array stays untouched in this case).
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).
there are a few more unchecked calls to `resizebytes()` (and `getbytes()`), 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.
---
Sent from sourceforge.net because pd-dev at lists.iem.at is subscribed to https://sourceforge.net/p/pure-data/patches/
To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/pure-data/admin/patches/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20151005/e9da9b2a/attachment.html>
More information about the Pd-dev
mailing list