[PD] big files with textfile

Mathieu Bouchard matju at artengine.ca
Sat Oct 27 20:44:02 CEST 2007

On Sat, 27 Oct 2007, marius schebella wrote:

> textfile can handle bigger files than msgfile, but there seems to be a 
> limit, too. I tried to open a >250MB file, and Pd crashed. marius.

If you measure bytes using an int32, the limit is 2GB, but if you measure 
it in bits, the limit is 256MB. [textfile] does read all the file into a 
buffer as big as the file. I didn't find anything that counts memory in 
bits, so perhaps it's just a coïncidence and the bug was something else, 
but I did fix another 256MB limit bug recently by adding parentheses in 
something like:

   num_entries * bits_per_entry / 8

When crossing the limit, the numbers become negative, and trying to 
allocate a negative amount causes the allocator to either abort the 
process or return NULL or corrupt memory...

  _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - tél:+1.514.383.3801, Montréal QC Canada

More information about the Pd-list mailing list