SQLite

Check-in [3e872011ff]
Login

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

Overview
Comment:Avoid leaving the malloc subsystem in a partially initialized state if the low-level initialization callback fails.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 3e872011ff5e27738c282f46d2b5803d94fe4b76
User & Date: drh 2015-03-26 17:04:23.798
Context
2015-03-26
18:24
Revise Win32 locking test to account for recent log message changes. (check-in: 1bc76339e8 user: mistachkin tags: trunk)
17:04
Avoid leaving the malloc subsystem in a partially initialized state if the low-level initialization callback fails. (check-in: 3e872011ff user: drh tags: trunk)
15:27
Provide source code line numbers for errors in the Windows VFS generated by the winLogIoerr() routine. (check-in: b5da0d93cd user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/malloc.c.
158
159
160
161
162
163
164

165
166
167
168
169
170
171
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172







+







  sqlite3_soft_heap_limit64(n);
}

/*
** Initialize the memory allocation subsystem.
*/
int sqlite3MallocInit(void){
  int rc;
  if( sqlite3GlobalConfig.m.xMalloc==0 ){
    sqlite3MemSetDefault();
  }
  memset(&mem0, 0, sizeof(mem0));
  if( sqlite3GlobalConfig.bCoreMutex ){
    mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
  }
193
194
195
196
197
198
199
200



201
202
203
204
205
206
207
194
195
196
197
198
199
200

201
202
203
204
205
206
207
208
209
210







-
+
+
+







  }
  if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512
      || sqlite3GlobalConfig.nPage<1 ){
    sqlite3GlobalConfig.pPage = 0;
    sqlite3GlobalConfig.szPage = 0;
    sqlite3GlobalConfig.nPage = 0;
  }
  return sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
  rc = sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData);
  if( rc!=SQLITE_OK ) memset(&mem0, 0, sizeof(mem0));
  return rc;
}

/*
** Return true if the heap is currently under memory pressure - in other
** words if the amount of heap used is close to the limit set by
** sqlite3_soft_heap_limit().
*/