WWW max download size

What is maximum size of the file that WWW can download before giving the “WWW: out of memory” error?

“out of memory” errors are always related to your hardware limitations. Since the WWW object returns the data either as string or as byte array it’s limited to 2GB as those structures can’t hold more due to it’s 32 bit length.

Again the 2GB limit is a technical limit. Depending on your used pllatform and the available memory there could be a lower limit. Since a byte array and a string requires a contiguous block of memory it’s possible due to memory fragmentation to run out of memory earlier as expected because the system can’t allocate a contiguous block of the required size.

if you’re testing your code in the editor, then it means you won’t be able to allocate more than 2GB of memory at a time. The WWW class needs to allocate a contiguous block of memory, and it tries to increase the allocated pool by 50% each time.

Likely, the problem is that memory fragmentation has reduced the largest allocatable block well below 2GB, so youre hitting the limit closer to 1-1.5GB. The smarter thing to do would be to split your download into smaller chunks and download them in sequence, so you don’t need to allocate a giant block of memory at once.