-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 2013-07-19 03:49, Фывапр Олджэвич wrote:
Dear List !
I made this patch to play long stereo audio file. You can load audiofile and play, but before - reset the sizes of tables.
BUT, it plays only one stereo file in my Vanilla. So when i played one file and try to load another: i push the RESET-bang .. and PD crushes totally..
well, i don't think it's Pd that's crashing - but rather the operating system that kills it.
why? at the beginning you create 2 tables and resize them to 1 (what is this for?) and then to 158760000 samples. given that Pd uses 4 bytes to save each sample (8 bytes on 64bit), this means that one table takes approximately 635MB (32bit) resp 1.27GB (64bit). so this gives you (for both tables) 1.27GB (32bit) resp 2.5GB (64bit) memory consumption. now when loading the table, you resize it, which potentially means allocating a new table which is bigger than the previous one, copying the data from the old table to the new one and then freeing the old table. so at some point you have doubled the amount of memory needed by your patch.
how much RAM do you have? is your system/OS capable of addressing more than 4GB of memory? (e.g. PAE) is your system/OS capable of addressing more than 4GB of memory within a single application? (64bit)
apart from that you patch is slightly buggy anyhow. imaging the following scenario:
seconds of your soundfile and 9:57 of silence.
did you know that [soundfiler] has a "-resize" switch that automatically resizes the table to your needs? btw, you might even want to resize your table to something small (1) before loading the sample.
adgmsr IOhannes