/ Check-in [541dd3b8]
Login

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

Overview
Comment:Disable the MEMSYS2 auxiliary routines if MEMSYS2 is changed to an alternative memory allocator using SQLITE_CONFIG_MALLOC.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 541dd3b870f123a5fddf0b710474693566a1d659
User & Date: drh 2010-08-20 09:53:20
Context
2010-08-20
10:28
Do not attempt run backwards compatibility tests if no historical "testfixture" binaries are available. check-in: 40e11aab user: drh tags: trunk
09:53
Disable the MEMSYS2 auxiliary routines if MEMSYS2 is changed to an alternative memory allocator using SQLITE_CONFIG_MALLOC. check-in: 541dd3b8 user: drh tags: trunk
09:14
Fix the sqlite3_release_memory() interface so that it does not attempt to free SQLITE_CONFIG_PAGECACHE memory. check-in: 0426cd62 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/mem2.c.

   374    374     sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods);
   375    375   }
   376    376   
   377    377   /*
   378    378   ** Set the "type" of an allocation.
   379    379   */
   380    380   void sqlite3MemdebugSetType(void *p, u8 eType){
   381         -  if( p ){
          381  +  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
   382    382       struct MemBlockHdr *pHdr;
   383    383       pHdr = sqlite3MemsysGetHeader(p);
   384    384       assert( pHdr->iForeGuard==FOREGUARD );
   385    385       pHdr->eType = eType;
   386    386     }
   387    387   }
   388    388   
................................................................................
   393    393   ** This routine is designed for use within an assert() statement, to
   394    394   ** verify the type of an allocation.  For example:
   395    395   **
   396    396   **     assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) );
   397    397   */
   398    398   int sqlite3MemdebugHasType(void *p, u8 eType){
   399    399     int rc = 1;
   400         -  if( p ){
          400  +  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
   401    401       struct MemBlockHdr *pHdr;
   402    402       pHdr = sqlite3MemsysGetHeader(p);
   403    403       assert( pHdr->iForeGuard==FOREGUARD );         /* Allocation is valid */
   404    404       if( (pHdr->eType&eType)==0 ){
   405    405         rc = 0;
   406    406       }
   407    407     }
................................................................................
   415    415   ** This routine is designed for use within an assert() statement, to
   416    416   ** verify the type of an allocation.  For example:
   417    417   **
   418    418   **     assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) );
   419    419   */
   420    420   int sqlite3MemdebugNoType(void *p, u8 eType){
   421    421     int rc = 1;
   422         -  if( p ){
          422  +  if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){
   423    423       struct MemBlockHdr *pHdr;
   424    424       pHdr = sqlite3MemsysGetHeader(p);
   425    425       assert( pHdr->iForeGuard==FOREGUARD );         /* Allocation is valid */
   426    426       if( (pHdr->eType&eType)!=0 ){
   427    427         rc = 0;
   428    428       }
   429    429     }