Buffer limit when loading files

I’v been running into strange non deterministic issues with the buffer limit. Im constantly writing code that is at the limit of the buffer size and sometimes code compiles & runs until it is saved and loaded again.

This happens when you load files with 400-500 lines of code and try to run it. If the code is copied to new buffer it runs … but loading from file and running the same code doesnt work.

It would be nice to have some sort of warning or indicator of how many letters there are left to avoid these issues.

1 Like

I have also observed this behaviour. Also I find that the buffer size available seems to depend on the platform used. The Mac seems to have a lower limit that when running on a Raspberry Pi. I have several programs which run happily on a Pi but give buffer full errors on a Mac. Because of this variability I’m not sure that a number of characters left display would work.

A large number of my programs exceed buffer size. I usually work using a separate text editor and use run_file with the text file produced, and have got used to working that way. I use bbedit on my Mac which has quite good facilities for search and replace, colour coding, collapsing code sections etc.
I mix using this with developing sections of the code within a Sonic Pi buffer.
Another tehcnique I use is to split programs over several buffers. Live_loops and the set…get functions work well with this. With careful writing you don’t have to duplicate much code in the 2 or 3 buffers you are using.

2 Likes

The buffer limit is due to a limitation in the approach we’re using to share code between the GUI and the server. This is currently within a single UDP packet which have finite sizes which vary depending on many factors.

Until we move to something like TCP for this, there is unfortunately a limit on the buffer size which is variable (but usually much larger than the vast majority of Sonic Pi programs written).