⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 c_config_getmalloc.html

📁 sqlite3源码,适合作为嵌入式(embedded)
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"><html><head><title>Configuration Options</title><style type="text/css">body {    margin: auto;    font-family: "Verdana" "sans-serif";    padding: 8px 1%;}a { color: #45735f }a:visited { color: #734559 }.logo { position:absolute; margin:3px; }.tagline {  float:right;  text-align:right;  font-style:italic;  width:240px;  margin:12px;  margin-top:58px;}.toolbar {  font-variant: small-caps;  text-align: center;  line-height: 1.6em;  margin: 0;  padding:1px 8px;}.toolbar a { color: white; text-decoration: none; padding: 6px 12px; }.toolbar a:visited { color: white; }.toolbar a:hover { color: #80a796; background: white; }.content    { margin: 5%; }.content dt { font-weight:bold; }.content dd { margin-bottom: 25px; margin-left:20%; }.content ul { padding:0px; padding-left: 15px; margin:0px; }/* rounded corners */.se  { background: url(../images/se.png) 100% 100% no-repeat #80a796}.sw  { background: url(../images/sw.png) 0% 100% no-repeat }.ne  { background: url(../images/ne.png) 100% 0% no-repeat }.nw  { background: url(../images/nw.png) 0% 0% no-repeat }</style><meta http-equiv="content-type" content="text/html; charset=UTF-8">  </head><body><div><!-- container div to satisfy validator --><a href="../index.html"><img class="logo" src="../images/SQLite.gif" alt="SQLite Logo" border="0"></a><div><!-- IE hack to prevent disappearing logo--></div><div class="tagline">Small. Fast. Reliable.<br>Choose any three.</div><table width=100% style="clear:both"><tr><td>  <div class="se"><div class="sw"><div class="ne"><div class="nw">  <div class="toolbar">    <a href="../about.html">About</a>    <a href="../sitemap.html">Sitemap</a>    <a href="../docs.html">Documentation</a>    <a href="../download.html">Download</a>    <a href="../copyright.html">License</a>    <a href="../news.html">News</a>    <a href="http://www.sqlite.org/cvstrac/index">Developers</a>    <a href="../support.html">Support</a>  </div></div></div></div></div></td></tr></table>  <a href="intro.html"><h2>SQLite C Interface</h2></a><h2>Configuration Options</h2><blockquote><pre>#define SQLITE_CONFIG_SINGLETHREAD  1  /* nil */#define SQLITE_CONFIG_MULTITHREAD   2  /* nil */#define SQLITE_CONFIG_SERIALIZED    3  /* nil */#define SQLITE_CONFIG_MALLOC        4  /* sqlite3_mem_methods* */#define SQLITE_CONFIG_GETMALLOC     5  /* sqlite3_mem_methods* */#define SQLITE_CONFIG_SCRATCH       6  /* void*, int sz, int N */#define SQLITE_CONFIG_PAGECACHE     7  /* void*, int sz, int N */#define SQLITE_CONFIG_HEAP          8  /* void*, int nByte, int min */#define SQLITE_CONFIG_MEMSTATUS     9  /* boolean */#define SQLITE_CONFIG_MUTEX        10  /* sqlite3_mutex_methods* */#define SQLITE_CONFIG_GETMUTEX     11  /* sqlite3_mutex_methods* *//* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ #define SQLITE_CONFIG_LOOKASIDE    13  /* int int */#define SQLITE_CONFIG_PCACHE       14  /* sqlite3_pcache_methods* */#define SQLITE_CONFIG_GETPCACHE    15  /* sqlite3_pcache_methods* */</pre></blockquote><p><b>Important:</b> This interface is <a href="../c3ref/experimental.html">experimental</a> and is subject to change without notice.</p><p>These constants are the available integer configuration options thatcan be passed as the first argument to the <a href="../c3ref/config.html">sqlite3_config()</a> interface.</p><p>New configuration options may be added in future releases of SQLite.Existing configuration options might be discontinued.  Applicationsshould check the return code from <a href="../c3ref/config.html">sqlite3_config()</a> to make sure thatthe call worked.  The <a href="../c3ref/config.html">sqlite3_config()</a> interface will return anon-zero <a href="../c3ref/c_abort.html">error code</a> if a discontinued or unsupported configuration optionis invoked.</p><p><dl><dt>SQLITE_CONFIG_SINGLETHREAD</dt><dd>There are no arguments to this option.  This option disablesall mutexing and puts SQLite into a mode where it can only be usedby a single thread.</dd></p><p><dt>SQLITE_CONFIG_MULTITHREAD</dt><dd>There are no arguments to this option.  This option disablesmutexing on <a href="../c3ref/sqlite3.html">database connection</a> and <a href="../c3ref/stmt.html">prepared statement</a> objects.The application is responsible for serializing access to<a href="../c3ref/sqlite3.html">database connections</a> and <a href="../c3ref/stmt.html">prepared statements</a>.  But other mutexesare enabled so that SQLite will be safe to use in a multi-threadedenvironment as long as no two threads attempt to use the same<a href="../c3ref/sqlite3.html">database connection</a> at the same time.  See the <a href="../threadsafe.html">threading mode</a>documentation for additional information.</dd></p><p><dt>SQLITE_CONFIG_SERIALIZED</dt><dd>There are no arguments to this option.  This option enablesall mutexes including the recursivemutexes on <a href="../c3ref/sqlite3.html">database connection</a> and <a href="../c3ref/stmt.html">prepared statement</a> objects.In this mode (which is the default when SQLite is compiled with<a href="../compile.html#threadsafe">SQLITE_THREADSAFE=1</a>) the SQLite library will itself serialize accessto <a href="../c3ref/sqlite3.html">database connections</a> and <a href="../c3ref/stmt.html">prepared statements</a> so that theapplication is free to use the same <a href="../c3ref/sqlite3.html">database connection</a> or thesame <a href="../c3ref/stmt.html">prepared statement</a> in different threads at the same time.See the <a href="../threadsafe.html">threading mode</a> documentation for additional information.</dd></p><p><dt>SQLITE_CONFIG_MALLOC</dt><dd>This option takes a single argument which is a pointer to aninstance of the <a href="../c3ref/mem_methods.html">sqlite3_mem_methods</a> structure.  The argument specifiesalternative low-level memory allocation routines to be used in place ofthe memory allocation routines built into SQLite.</dd></p><p><dt>SQLITE_CONFIG_GETMALLOC</dt><dd>This option takes a single argument which is a pointer to aninstance of the <a href="../c3ref/mem_methods.html">sqlite3_mem_methods</a> structure.  The <a href="../c3ref/mem_methods.html">sqlite3_mem_methods</a>structure is filled with the currently defined memory allocation routines.This option can be used to overload the default memory allocationroutines with a wrapper that simulations memory allocation failure ortracks memory usage, for example.</dd></p><p><dt>SQLITE_CONFIG_MEMSTATUS</dt><dd>This option takes single argument of type int, interpreted as aboolean, which enables or disables the collection of memory allocationstatistics. When disabled, the following SQLite interfaces becomenon-operational:<ul><li> <a href="../c3ref/memory_highwater.html">sqlite3_memory_used()</a><li> <a href="../c3ref/memory_highwater.html">sqlite3_memory_highwater()</a><li> <a href="../c3ref/soft_heap_limit.html">sqlite3_soft_heap_limit()</a><li> <a href="../c3ref/status.html">sqlite3_status()</a></ul></dd></p><p><dt>SQLITE_CONFIG_SCRATCH</dt><dd>This option specifies a static memory buffer that SQLite can use forscratch memory.  There are three arguments:  A pointer to the memory, thesize of each scratch buffer (sz), and the number of buffers (N).  The szargument must be a multiple of 16. The sz parameter should be a few byteslarger than the actual scratch space required due internal overhead.The firstargument should point to an allocation of at least sz*N bytes of memory.SQLite will use no more than one scratch buffer at once per thread, soN should be set to the expected maximum number of threads.  The szparameter should be 6 times the size of the largest database page size.Scratch buffers are used as part of the btree balance operation.  IfThe btree balancer needs additional memory beyond what is provided byscratch buffers or if no scratch buffer space is specified, then SQLitegoes to <a href="../c3ref/free.html">sqlite3_malloc()</a> to obtain the memory it needs.</dd></p><p><dt>SQLITE_CONFIG_PAGECACHE</dt><dd>This option specifies a static memory buffer that SQLite can use forthe database page cache with the default page cache implemenation.This configuration should not be used if an application-define pagecache implementation is loaded using the SQLITE_CONFIG_PCACHE option.There are three arguments to this option: A pointer to thememory, the size of each page buffer (sz), and the number of pages (N).The sz argument must be a power of two between 512 and 32768.  The firstargument should point to an allocation of at least sz*N bytes of memory.SQLite will use the memory provided by the first argument to satisfy itsmemory needs for the first N pages that it adds to cache.  If additionalpage cache memory is needed beyond what is provided by this option, thenSQLite goes to <a href="../c3ref/free.html">sqlite3_malloc()</a> for the additional storage space.The implementation might use one or more of the N buffers to holdmemory accounting information. </dd></p><p><dt>SQLITE_CONFIG_HEAP</dt><dd>This option specifies a static memory buffer that SQLite will usefor all of its dynamic memory allocation needs beyond those providedfor by <a href="../c3ref/c_config_getmalloc.html">SQLITE_CONFIG_SCRATCH</a> and <a href="../c3ref/c_config_getmalloc.html">SQLITE_CONFIG_PAGECACHE</a>.There are three arguments: A pointer to the memory, the number ofbytes in the memory buffer, and the minimum allocation size.  Ifthe first pointer (the memory pointer) is NULL, then SQLite revertsto using its default memory allocator (the system malloc() implementation),undoing any prior invocation of <a href="../c3ref/c_config_getmalloc.html">SQLITE_CONFIG_MALLOC</a>.  If thememory pointer is not NULL and either <a href="../compile.html#enable_memsys3">SQLITE_ENABLE_MEMSYS3</a> or<a href="../compile.html#enable_memsys5">SQLITE_ENABLE_MEMSYS5</a> are defined, then the alternative memoryallocator is engaged to handle all of SQLites memory allocation needs.</dd></p><p><dt>SQLITE_CONFIG_MUTEX</dt><dd>This option takes a single argument which is a pointer to aninstance of the <a href="../c3ref/mutex_methods.html">sqlite3_mutex_methods</a> structure.  The argument specifiesalternative low-level mutex routines to be used in placethe mutex routines built into SQLite.</dd></p><p><dt>SQLITE_CONFIG_GETMUTEX</dt><dd>This option takes a single argument which is a pointer to aninstance of the <a href="../c3ref/mutex_methods.html">sqlite3_mutex_methods</a> structure.  The<a href="../c3ref/mutex_methods.html">sqlite3_mutex_methods</a>structure is filled with the currently defined mutex routines.This option can be used to overload the default mutex allocationroutines with a wrapper used to track mutex usage for performanceprofiling or testing, for example.</dd></p><p><dt>SQLITE_CONFIG_LOOKASIDE</dt><dd>This option takes two arguments that determine the defaultmemory allcation lookaside optimization.  The first argument is thesize of each lookaside buffer slot and the second is the number ofslots allocated to each database connection.</dd></p><p><dt>SQLITE_CONFIG_PCACHE</dt><dd>This option takes a single argument which is a pointer toan <a href="../c3ref/pcache_methods.html">sqlite3_pcache_methods</a> object.  This object specifies the interfaceto a custom page cache implementation.  SQLite makes a copy of theobject and uses it for page cache memory allocations.</dd></p><p><dt>SQLITE_CONFIG_GETPCACHE</dt><dd>This option takes a single argument which is a pointer to an<a href="../c3ref/pcache_methods.html">sqlite3_pcache_methods</a> object.  SQLite copies of the currentpage cache implementation into that object.</dd></p><p></dl></p><p>See also lists of  <a href="objlist.html">Objects</a>,  <a href="constlist.html">Constants</a>, and  <a href="funclist.html">Functions</a>.</p><hr><small><i>This page last modified 2008/12/09 18:44:04 UTC</i></small></div></body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -