SQLite Forum

sqlite3_serialize / deserialize 2GB limit on 64 bit
Login
The underlying code calls sqlite3_malloc64 which calls sqlite3Malloc.  That method fails with allocations above 2GB even on 64 bit platforms.  Is the intention to have this undocumented limit to serialize/deserialize?

The code for sqlite3Malloc has this comment:

    if( n==0 || n>=0x7fffff00 ){
        /* A memory allocation of a number of bytes which is near the maximum
        ** signed integer value might cause an integer overflow inside of the
        ** xMalloc().  Hence we limit the maximum size to 0x7fffff00, giving
        ** 255 bytes of overhead.  SQLite itself will never use anything near
       ** this amount.  The only way to reach the limit is with sqlite3_malloc() */

SQLite needs this amount and more for serialization and for me to call deserialize and have SQLite free the memory.


Roger