Help Center

CSQLiteStmt.Reallocmethod

Attempts to resize a prior memory allocation to be at least the specified number of bytes.

DatabasesmethodCSQLite.incdoc-orphan
No implementation located. This member is documented, but the source scan found no matching declaration. It is likely declared in a header this scan does not resolve, or provided by a macro.

Syntax

FUNCTION Realloc (BYVAL pMem AS ANY PTR, BYVAL nBytes AS LONG) AS ANY PTR

Parameters

NameDescription
pMemPointer to memory allocated by Malloc.
nBytesThe number of bytes to reallocate.
nBytesThe number of bytes to free.

Return value

Pointer to the reallocated memory.

The number of bytes freed.

Description

Attempts to resize a prior memory allocation to be at least nBytes bytes. pMem is the memory allocation to be resized.

Remarks

The memory returned by Malloc and Realloc is always aligned to at least an 8 byte boundary, or to a 4 byte boundary if the SQLITE_4_BYTE_ALIGNED_MALLOC compile-time option is used.

In SQLite version 3.5.0 and 3.5.1, it was possible to define the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in implementation of these functions to be omitted. That capability is no longer provided. Only built-in memory allocators can be used.

Prior to SQLite version 3.7.10, the Windows OS interface layer called the system malloc and free directly when converting filenames between the UTF-8 encoding used by SQLite and whatever filename encoding is used by the particular Windows installation. Memory allocation errors were detected, but they were reported back as SQLITE_CANTOPEN or SQLITE_IOERR rather than SQLITE_NOMEM.

The pointer arguments to Free and Realloc must be either NULL or else pointers obtained from a prior invocation of Malloc or Realloc that have not yet been released.

The application must not read or write any part of a block of memory after it has been released using Free or Realloc.

Reference

  • Include file CSQLite.inc
  • Documented in Databases/CSQLite Class.md
  • Topic: CSQLite Class