SQLite

Check-in [5c0fe63a63]
Login

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

Overview
Comment:Mark the hash table enlargement in pcache1.c as a benign-failure malloc. (CVS 5986)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5c0fe63a6374abe98e45c11ada54c064c19bbab8
User & Date: drh 2008-12-06 14:34:34.000
Context
2008-12-06
16:10
Make sure the KeyInfo object attached to a transient table used for sorting records the sqlite3 object used for memory allocation, so that memory allocation failures on UTF16 to UTF8 conversion can be recorded. (CVS 5987) (check-in: 76246d9f0d user: drh tags: trunk)
14:34
Mark the hash table enlargement in pcache1.c as a benign-failure malloc. (CVS 5986) (check-in: 5c0fe63a63 user: drh tags: trunk)
2008-12-05
23:40
Make the minimum allocate size for RowSet objects large enough to accommodate 8-byte pointers. (CVS 5985) (check-in: b74885e085 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/pcache1.c.
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
**
** This file implements the default page cache implementation (the
** sqlite3_pcache interface). It also contains part of the implementation
** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features.
** If the default page cache implementation is overriden, then neither of
** these two features are available.
**
** @(#) $Id: pcache1.c,v 1.4 2008/11/24 20:05:39 shane Exp $
*/

#include "sqliteInt.h"

typedef struct PCache1 PCache1;
typedef struct PgHdr1 PgHdr1;
typedef struct PgFreeslot PgFreeslot;







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
**
** This file implements the default page cache implementation (the
** sqlite3_pcache interface). It also contains part of the implementation
** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features.
** If the default page cache implementation is overriden, then neither of
** these two features are available.
**
** @(#) $Id: pcache1.c,v 1.5 2008/12/06 14:34:34 drh Exp $
*/

#include "sqliteInt.h"

typedef struct PCache1 PCache1;
typedef struct PgHdr1 PgHdr1;
typedef struct PgFreeslot PgFreeslot;
259
260
261
262
263
264
265

266

267
268
269
270
271
272
273

  nNew = p->nHash*2;
  if( nNew<256 ){
    nNew = 256;
  }

  pcache1LeaveMutex();

  apNew = (PgHdr1 **)sqlite3_malloc(sizeof(PgHdr1 *)*nNew);

  pcache1EnterMutex();
  if( apNew ){
    memset(apNew, 0, sizeof(PgHdr1 *)*nNew);
    for(i=0; i<p->nHash; i++){
      PgHdr1 *pPage;
      PgHdr1 *pNext = p->apHash[i];
      while( (pPage = pNext) ){







>

>







259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275

  nNew = p->nHash*2;
  if( nNew<256 ){
    nNew = 256;
  }

  pcache1LeaveMutex();
  if( p->nHash ){ sqlite3BeginBenignMalloc(); }
  apNew = (PgHdr1 **)sqlite3_malloc(sizeof(PgHdr1 *)*nNew);
  if( p->nHash ){ sqlite3EndBenignMalloc(); }
  pcache1EnterMutex();
  if( apNew ){
    memset(apNew, 0, sizeof(PgHdr1 *)*nNew);
    for(i=0; i<p->nHash; i++){
      PgHdr1 *pPage;
      PgHdr1 *pNext = p->apHash[i];
      while( (pPage = pNext) ){