SQLite Forum

Freeing memory used in sqlite£-result_blob
Login
Also do not forget the significance that a memory block allocated by SQLite3 via the SQLITE_TRANSIENT method is a memory block that "belongs" to SQLite3 and comes from SQLite3's heap, and that SQLite3 can realloc (for example) since it knows all about how such memory blocks are maintained and may be maipulated.

When you pass a pointer and a destructor, all SQLite3 has is a "foreign" pointer and a destructor function.  The only thing that SQLite3 can do with the "foreign" memory is to read / write (within the bounds it has been told) / call the destructor.

There may exist cases where this difference is significant.  This applies equally to "text" since there is no physical difference between a blob and text, merely a symantic (touchy feely) difference.  You will note that all other data types (integer/real) are passed by coping to a thing under SQLite3's control in the same manner as SQLITE_TRANSIENT (just that the size of the memory area is much smaller (8 bytes or less) and different "feelies" are attached to it).