勇芳软件工作室.汉化:  SQLite3 API Functions > General >

sqlite3_release_memory

Previous pageReturn to chapter overviewNext page

描述

 

尝试通过释放数据库所保存的非必要内存分配来释放指定数量的堆内存字节数。用于缓存数据库页面以提高性能的内存是非必要内存的示例。sqlite3_release_memory返回实际释放的字节数,可能大于或小于请求的数量。如果SQLite不使用SQLITE_ENABLE_MEMORY_MANAGEMENT进行编译,则sqlite3_release_memory函数是无操作返回零。

 

C / C ++语法

 

int sqlite3_release_memory(int);

 

PB语法

 

FUNCTION sqlite3_release_memory ( _

BYVAL numBytes AS LONG _

) AS LONG

 

参数

 

numBytes

 

[in]要释放的字节数。

 

返回值

 

字节数释放。

 

C ++实现代码

 

/*

** Attempt to release up to n bytes of non-essential memory currently

** held by SQLite. An example of non-essential memory is memory used to

** cache database pages that are not currently in use.

*/

SQLITE_API int sqlite3_release_memory(int n){

#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT

return sqlite3PcacheReleaseMemory(n);

#else

/* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() function

** is a no-op returning zero if SQLite is not compiled with

** SQLITE_ENABLE_MEMORY_MANAGEMENT. */

UNUSED_PARAMETER(n);

return 0;

#endif

}