Maximum buffer size ? any limitation beyond RAM ?

Salvator's icon

Hello,

I'm facing issue with allocating large buffer size.

After browsing the forums for a over an hour, I do understand some things like MSP's 32bits float doubling size, but still I'm guessing if there is an overall limitation beyond available RAM, because on a 3Go Ram PC I was not able to go beyond 59 min of a stereo buffer.

So I did a little patch to understand the issue :

So far, there is differents error messages when trying to allocate or load large memory :
- "out of memory" message when trying to load large file
- "not enough memory to resize" when trying to resize
- "• error: buffer~: size: bad size ." when trying to resize bigger

I understand the two first message, but what means the "bad size" message ? Do adding more RAM will help or is this a limitation of the buffer~ external, whatever the embed RAM is ?

i.e. trying to resize to 102 min on MONO buffer was giving the same "bad size" message in any tested computer, even with 3Gb of RAM.

What's surprising is that on my little powerbook with 512 Mo, I was able to get as much as in the big PC. (59min of stereo- same 102 min ceiling)

My goal is to read or record files up to 2Gb in PC's with about 4Gb of Ram, and do processing in nonrealtime (so sfrecord~ is kind of a dead horse...)

Thanks for any help !

Salvator

Max Patch
Copy patch and select New From Clipboard in Max.

Salvator's icon

Hello,

I'm still try to find workaround for PC, but no sucess so far.

What's surprising is that the RAM used by max no that much while the "not enough memory to resize" already appear.

For example, I have a PC with 2 Go of RAM, and in max I can allocate a 50 min buffer which show about 1.1Go of RAM usage in "activity monitor" (considering it's 32bits float).

SO I still have about 700 Mo of available RAM, but still I can't do a larger buffer or add another one. Why ?

I've tried this with another PC which has 3.12G of Ram, and same "not enough memory" message, even if I have still above 1.5G of unused RAM.

Thanks you C74 for any help or advice. I've tried on about 6 PC's computer so far with Max 4.6.3 and it's runtime, under windows XP SP2

Salvator

keepsound's icon
Max Patch
Copy patch and select New From Clipboard in Max.
rjungemann's icon

I suspect the way to go is to use two smaller buffers and toggle between them. To read a really long file: read part of an audio file in to buffer A, when it fills up, play back buffer A. Meanwhile, read the next part into buffer B. When buffer A is done playing, start playing buffer B and begin reading the next segment into buffer A. And so on.

Or, if you want to record longer buffers, record into buffer A, when it fills up, toggle to recording into buffer B, while saving buffer A to HD. And so on.

The functionality could be hidden in an abstraction, and when using the abstraction, you wouldn't need to think about the implementation at all.

I can't comment exactly on the 32-bit issue or why the amount you can keep in a [buffer~] is different on different systems. IIRC, a 32-bit app may address up to 4GB of memory, so it is surprising that it appears to crap out at 2GB or less.