SQLite

Check-in [f9b5c5cb13]
Login

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

Overview
Comment:Fix a couple of incorrect evidence marks on malloc().
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f9b5c5cb135f3d0bb2b64b4d3f8d77bbd8d2ae98
User & Date: drh 2010-09-11 16:25:43.000
Context
2010-09-11
17:37
Add tests for "DISTINCT" and "ALL" to e_select.test. (check-in: 43a99d9a88 user: dan tags: trunk)
16:25
Fix a couple of incorrect evidence marks on malloc(). (check-in: f9b5c5cb13 user: drh tags: trunk)
16:15
Additional evidence marks on the malloc() implementation. Update the documentation to explain that mallocs are not necessarily 8-byte aligned if the SQLITE_4_BYTE_ALIGNED_MALLOC compile-time option is used. (check-in: 42b4bf9e72 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/malloc.c.
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
  }else if( sqlite3GlobalConfig.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    mallocWithAlarm(n, &p);
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    p = sqlite3GlobalConfig.m.xMalloc(n);
  }
  assert( EIGHT_BYTE_ALIGNMENT(p) );  /* IMP: R-36023-12588 */
  return p;
}

/*
** This version of the memory allocation is for use by the application.
** First make sure the memory subsystem is initialized, then do the
** allocation.







|







305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
  }else if( sqlite3GlobalConfig.bMemstat ){
    sqlite3_mutex_enter(mem0.mutex);
    mallocWithAlarm(n, &p);
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    p = sqlite3GlobalConfig.m.xMalloc(n);
  }
  assert( EIGHT_BYTE_ALIGNMENT(p) );  /* IMP: R-04675-44850 */
  return p;
}

/*
** This version of the memory allocation is for use by the application.
** First make sure the memory subsystem is initialized, then do the
** allocation.
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
      nNew = sqlite3MallocSize(pNew);
      sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld);
    }
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
  }
  assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-36023-12588 */
  return pNew;
}

/*
** The public interface to sqlite3Realloc.  Make sure that the memory
** subsystem is initialized prior to invoking sqliteRealloc.
*/







|







543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
      nNew = sqlite3MallocSize(pNew);
      sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld);
    }
    sqlite3_mutex_leave(mem0.mutex);
  }else{
    pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew);
  }
  assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-04675-44850 */
  return pNew;
}

/*
** The public interface to sqlite3Realloc.  Make sure that the memory
** subsystem is initialized prior to invoking sqliteRealloc.
*/