That isn't the real limitation when it comes to disk file size. The 2GB limit has nothing to do with disk file limit. On NTFS, on that same page you listed, the maximum file size is 16 EiB. Even if you can only hold so much data in RAM, you can download in smaller segments at a time, transfer to disk, clear memory, then repeat.
@NoXzema: It could be the real limitation since we do not know if the OP is running this program on a NTFS disk. For example imagine the OP was downloading files to a USB stick formatted with FAT16. Either the OP is not staging 2GB at a time if the RAM is limited, or the file system is unable to handle files growing beyond 2GB.
That error wouldn't be caused by that anyways. That's also an incredible amount of assumption and even if it was that, that's still not the 2GB limit problem you linked above.
EDIT: In addition to that, FAT32 has a 4gB file limit, not 2gB.
You made the assumption that the OP is using NTFS, and erroneously dismissed file system limitations based on that assumption. Curl could fail on a fat16 device past 2GB. I am trying not to make an assumption about the file system the OP is using and I did say FAT16 not 32...
I decided to do a bit of research and turned up this bit of documentation https://curl.haxx.se/libcurl/c/CURLOPT_MAXFILESIZE.html I now see this as the most likely source of the error. I found it when I was starting to write an example to run against a drive that I formatted to FAT16.