aboutsummaryrefslogtreecommitdiff
path: root/src/malloc.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2010-08-31 15:27:32 +0000
committerdrh <drh@noemail.net>2010-08-31 15:27:32 +0000
commit9f129f467e7961b3225a0ecc37d26cddc9155943 (patch)
tree9b79e74a77f70b2bb1762e9b2548d1531f4b4d04 /src/malloc.c
parent18ec96b3a3a138c8e54f4fcc56102f246004ade4 (diff)
downloadsqlite-9f129f467e7961b3225a0ecc37d26cddc9155943.tar.gz
sqlite-9f129f467e7961b3225a0ecc37d26cddc9155943.zip
Add evidence mark comments to source code. Add additional information to the
documentation of sqlite3_release_memory(). Fix a minor inefficiency in mem1.c that was discovered while writing requirements tests. FossilOrigin-Name: 53b0c03fd33d2d8141fd386de5493fec64456042
Diffstat (limited to 'src/malloc.c')
-rw-r--r--src/malloc.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/malloc.c b/src/malloc.c
index 0b19cff8b..ac1910389 100644
--- a/src/malloc.c
+++ b/src/malloc.c
@@ -62,12 +62,13 @@ void sqlite3_soft_heap_limit(int n){
*/
int sqlite3_release_memory(int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
- int nRet = 0;
- nRet += sqlite3PcacheReleaseMemory(n-nRet);
- return nRet;
+ return sqlite3PcacheReleaseMemory(n);
#else
+ /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine
+ ** is a no-op returning zero if SQLite is not compiled with
+ ** SQLITE_ENABLE_MEMORY_MANAGEMENT. */
UNUSED_PARAMETER(n);
- return SQLITE_OK;
+ return 0;
#endif
}
@@ -511,6 +512,9 @@ void *sqlite3Realloc(void *pOld, int nBytes){
return 0;
}
nOld = sqlite3MallocSize(pOld);
+ /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second
+ ** argument to xRealloc is always a value returned by a prior call to
+ ** xRoundup. */
nNew = sqlite3GlobalConfig.m.xRoundup(nBytes);
if( nOld==nNew ){
pNew = pOld;