Menu

Memory Managment in SQLite3

Memory Managment in SQLite3.


  • When SQLite needs to dynamically allocate memory, it normally calls the default memory handler of the underlying operating system. This causes SQLite to allocate its memory from the application heap.
  • SQLite memory management functions:
  • sqlite3_malloc()
  • sqlite3_realloc()
  • sqlite3_free()
  • void* sqlite3_malloc( int numBytes ) Allocates and returns a buffer of the size specified. If the memory cannot be allocated, a NULL pointer is returned. Memory will always be 8-byte (64-bit) aligned.
  • void* sqlite3_realloc( void *buffer, int numBytes ) Used to resize a memory allocation. Buffers can be made larger or smaller. Given a buffer previously returned by sqlite3_malloc() and a byte count, *_realloc() will alloc new buffer of the specified size and copy as much of the old buffer as will fit into the new buffer. It will then free the old buffer and return the new buffer. If the new buffer cannot be allocated, a NULL is returned and the original buffer is not freed.
  • void sqlite3_free( void *buffer )
  • Releases a memory buffer previously allocated by sqlite3_malloc() or sqlite3_realloc().


For More Information Please Visit
swamios

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...