Name

sqlite3_malloc() — Obtain a dynamic memory allocation

Definition

void* sqlite3_malloc( int bytes );
bytes

The size of the requested allocation, in bytes.

Returns

A newly allocated buffer. If the memory is not available, NULL is returned.

Description

This function obtains a dynamic memory allocation from the SQLite library. Memory allocated with sqlite3_malloc() should be released with sqlite3_free(). Allocations will always start on an 8-byte (or larger) boundary.

Although many SQLite environments will simply pass memory allocation requests on to the default system memory allocator, there are some environments that configure specific buffers for the SQLite library. By using these memory handling functions, an SQLite extension or module will work correctly in any SQLite environment, regardless of how the memory allocator is configured.

Get Using SQLite now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.