Eduardo Morras wrote:
> On Sat, 8 Mar 2014 14:09:17 -0500
> Richard Hipp <d...@sqlite.org> wrote:
>> It isn't really running out of memory....
>>
>> The implementation of char() allocates 4 bytes of output buffer for
>> each input character, which is sufficient to hold any valid unicode
>> codepoint. But with zero input characters, that means it tries to
>> allocate a zero-byte output buffer.  sqlite3_malloc() returns NULL
>> when asked to allocate zero bytes, at which point the char()
>> implementation thinks that the malloc() failed and reports the
>> output-of-memory error.
> 
> It's OS dependant. From malloc FreeBSD man page [...]

malloc() behavior wrt 0-byte allocation is OS-dependent.
sqlite3_malloc() is not: it will return NULL on any OS, regardless of malloc()
implementation.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to