/ Check-in [8c85b8fd]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the build for SQLITE_ENABLE_MEMORY_MANAGEMENT.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 8c85b8fdd7f0ba65fba83361d361a567b797a184
User & Date: drh 2017-01-13 12:53:35
Context
2017-01-13
18:24
Fix a problem preventing resumption of RBU operations after recovering from a process or system failure that occurs during the incremental-checkpoint phase. check-in: 97914266 user: dan tags: trunk
12:53
Fix the build for SQLITE_ENABLE_MEMORY_MANAGEMENT. check-in: 8c85b8fd user: drh tags: trunk
2017-01-12
19:10
Remove a branch that is probably unreachable, and which adds no value. check-in: 9acc7238 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/malloc.c.

   215    215   
   216    216   /*
   217    217   ** Do a memory allocation with statistics and alarms.  Assume the
   218    218   ** lock is already held.
   219    219   */
   220    220   static void mallocWithAlarm(int n, void **pp){
   221    221     void *p;
          222  +  int nFull = 0;
   222    223     assert( sqlite3_mutex_held(mem0.mutex) );
   223    224     sqlite3StatusHighwater(SQLITE_STATUS_MALLOC_SIZE, n);
   224    225     if( mem0.alarmThreshold>0 ){
   225    226       sqlite3_int64 nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED);
   226         -    int nFull = sqlite3GlobalConfig.m.xRoundup(n);
          227  +    nFull = sqlite3GlobalConfig.m.xRoundup(n);
   227    228       if( nUsed >= mem0.alarmThreshold - nFull ){
   228    229         mem0.nearlyFull = 1;
   229    230         sqlite3MallocAlarm(nFull);
   230    231       }else{
   231    232         mem0.nearlyFull = 0;
   232    233       }
   233    234     }
................................................................................
   235    236   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
   236    237     if( p==0 && mem0.alarmThreshold>0 ){
   237    238       sqlite3MallocAlarm(nFull);
   238    239       p = sqlite3GlobalConfig.m.xMalloc(n);
   239    240     }
   240    241   #endif
   241    242     if( p ){
   242         -    int nFull = sqlite3MallocSize(p);
          243  +    nFull = sqlite3MallocSize(p);
   243    244       sqlite3StatusUp(SQLITE_STATUS_MEMORY_USED, nFull);
   244    245       sqlite3StatusUp(SQLITE_STATUS_MALLOC_COUNT, 1);
   245    246     }
   246    247     *pp = p;
   247    248   }
   248    249   
   249    250   /*