mem3             17977 ext/sqlite3/libsqlite/sqlite3.c } mem3 = { 97535575 };
mem3             17979 ext/sqlite3/libsqlite/sqlite3.c #define mem3 GLOBAL(struct Mem3Global, mem3)
mem3             17986 ext/sqlite3/libsqlite/sqlite3.c   u32 next = mem3.aPool[i].u.list.next;
mem3             17987 ext/sqlite3/libsqlite/sqlite3.c   u32 prev = mem3.aPool[i].u.list.prev;
mem3             17988 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             17992 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[prev].u.list.next = next;
mem3             17995 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[next].u.list.prev = prev;
mem3             17997 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i].u.list.next = 0;
mem3             17998 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i].u.list.prev = 0;
mem3             18007 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18008 ext/sqlite3/libsqlite/sqlite3.c   assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
mem3             18010 ext/sqlite3/libsqlite/sqlite3.c   size = mem3.aPool[i-1].u.hdr.size4x/4;
mem3             18011 ext/sqlite3/libsqlite/sqlite3.c   assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
mem3             18014 ext/sqlite3/libsqlite/sqlite3.c     memsys3UnlinkFromList(i, &mem3.aiSmall[size-2]);
mem3             18017 ext/sqlite3/libsqlite/sqlite3.c     memsys3UnlinkFromList(i, &mem3.aiHash[hash]);
mem3             18026 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18027 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i].u.list.next = *pRoot;
mem3             18028 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i].u.list.prev = 0;
mem3             18030 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[*pRoot].u.list.prev = i;
mem3             18041 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18043 ext/sqlite3/libsqlite/sqlite3.c   assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 );
mem3             18044 ext/sqlite3/libsqlite/sqlite3.c   size = mem3.aPool[i-1].u.hdr.size4x/4;
mem3             18045 ext/sqlite3/libsqlite/sqlite3.c   assert( size==mem3.aPool[i+size-1].u.hdr.prevSize );
mem3             18048 ext/sqlite3/libsqlite/sqlite3.c     memsys3LinkIntoList(i, &mem3.aiSmall[size-2]);
mem3             18051 ext/sqlite3/libsqlite/sqlite3.c     memsys3LinkIntoList(i, &mem3.aiHash[hash]);
mem3             18061 ext/sqlite3/libsqlite/sqlite3.c   if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){
mem3             18062 ext/sqlite3/libsqlite/sqlite3.c     mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
mem3             18064 ext/sqlite3/libsqlite/sqlite3.c   sqlite3_mutex_enter(mem3.mutex);
mem3             18067 ext/sqlite3/libsqlite/sqlite3.c   sqlite3_mutex_leave(mem3.mutex);
mem3             18074 ext/sqlite3/libsqlite/sqlite3.c   if( !mem3.alarmBusy ){
mem3             18075 ext/sqlite3/libsqlite/sqlite3.c     mem3.alarmBusy = 1;
mem3             18076 ext/sqlite3/libsqlite/sqlite3.c     assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18077 ext/sqlite3/libsqlite/sqlite3.c     sqlite3_mutex_leave(mem3.mutex);
mem3             18079 ext/sqlite3/libsqlite/sqlite3.c     sqlite3_mutex_enter(mem3.mutex);
mem3             18080 ext/sqlite3/libsqlite/sqlite3.c     mem3.alarmBusy = 0;
mem3             18092 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18094 ext/sqlite3/libsqlite/sqlite3.c   assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock );
mem3             18095 ext/sqlite3/libsqlite/sqlite3.c   assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock );
mem3             18096 ext/sqlite3/libsqlite/sqlite3.c   x = mem3.aPool[i-1].u.hdr.size4x;
mem3             18097 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2);
mem3             18098 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock;
mem3             18099 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2;
mem3             18100 ext/sqlite3/libsqlite/sqlite3.c   return &mem3.aPool[i];
mem3             18109 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18110 ext/sqlite3/libsqlite/sqlite3.c   assert( mem3.szMaster>=nBlock );
mem3             18111 ext/sqlite3/libsqlite/sqlite3.c   if( nBlock>=mem3.szMaster-1 ){
mem3             18113 ext/sqlite3/libsqlite/sqlite3.c     void *p = memsys3Checkout(mem3.iMaster, mem3.szMaster);
mem3             18114 ext/sqlite3/libsqlite/sqlite3.c     mem3.iMaster = 0;
mem3             18115 ext/sqlite3/libsqlite/sqlite3.c     mem3.szMaster = 0;
mem3             18116 ext/sqlite3/libsqlite/sqlite3.c     mem3.mnMaster = 0;
mem3             18121 ext/sqlite3/libsqlite/sqlite3.c     newi = mem3.iMaster + mem3.szMaster - nBlock;
mem3             18122 ext/sqlite3/libsqlite/sqlite3.c     assert( newi > mem3.iMaster+1 );
mem3             18123 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = nBlock;
mem3             18124 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x |= 2;
mem3             18125 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1;
mem3             18126 ext/sqlite3/libsqlite/sqlite3.c     mem3.szMaster -= nBlock;
mem3             18127 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[newi-1].u.hdr.prevSize = mem3.szMaster;
mem3             18128 ext/sqlite3/libsqlite/sqlite3.c     x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
mem3             18129 ext/sqlite3/libsqlite/sqlite3.c     mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
mem3             18130 ext/sqlite3/libsqlite/sqlite3.c     if( mem3.szMaster < mem3.mnMaster ){
mem3             18131 ext/sqlite3/libsqlite/sqlite3.c       mem3.mnMaster = mem3.szMaster;
mem3             18133 ext/sqlite3/libsqlite/sqlite3.c     return (void*)&mem3.aPool[newi];
mem3             18156 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18158 ext/sqlite3/libsqlite/sqlite3.c     iNext = mem3.aPool[i].u.list.next;
mem3             18159 ext/sqlite3/libsqlite/sqlite3.c     size = mem3.aPool[i-1].u.hdr.size4x;
mem3             18163 ext/sqlite3/libsqlite/sqlite3.c       assert( i > mem3.aPool[i-1].u.hdr.prevSize );
mem3             18164 ext/sqlite3/libsqlite/sqlite3.c       prev = i - mem3.aPool[i-1].u.hdr.prevSize;
mem3             18166 ext/sqlite3/libsqlite/sqlite3.c         iNext = mem3.aPool[prev].u.list.next;
mem3             18170 ext/sqlite3/libsqlite/sqlite3.c       x = mem3.aPool[prev-1].u.hdr.size4x & 2;
mem3             18171 ext/sqlite3/libsqlite/sqlite3.c       mem3.aPool[prev-1].u.hdr.size4x = size*4 | x;
mem3             18172 ext/sqlite3/libsqlite/sqlite3.c       mem3.aPool[prev+size-1].u.hdr.prevSize = size;
mem3             18178 ext/sqlite3/libsqlite/sqlite3.c     if( size>mem3.szMaster ){
mem3             18179 ext/sqlite3/libsqlite/sqlite3.c       mem3.iMaster = i;
mem3             18180 ext/sqlite3/libsqlite/sqlite3.c       mem3.szMaster = size;
mem3             18197 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18212 ext/sqlite3/libsqlite/sqlite3.c     i = mem3.aiSmall[nBlock-2];
mem3             18214 ext/sqlite3/libsqlite/sqlite3.c       memsys3UnlinkFromList(i, &mem3.aiSmall[nBlock-2]);
mem3             18219 ext/sqlite3/libsqlite/sqlite3.c     for(i=mem3.aiHash[hash]; i>0; i=mem3.aPool[i].u.list.next){
mem3             18220 ext/sqlite3/libsqlite/sqlite3.c       if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){
mem3             18221 ext/sqlite3/libsqlite/sqlite3.c         memsys3UnlinkFromList(i, &mem3.aiHash[hash]);
mem3             18231 ext/sqlite3/libsqlite/sqlite3.c   if( mem3.szMaster>=nBlock ){
mem3             18243 ext/sqlite3/libsqlite/sqlite3.c   for(toFree=nBlock*16; toFree<(mem3.nPool*16); toFree *= 2){
mem3             18245 ext/sqlite3/libsqlite/sqlite3.c     if( mem3.iMaster ){
mem3             18246 ext/sqlite3/libsqlite/sqlite3.c       memsys3Link(mem3.iMaster);
mem3             18247 ext/sqlite3/libsqlite/sqlite3.c       mem3.iMaster = 0;
mem3             18248 ext/sqlite3/libsqlite/sqlite3.c       mem3.szMaster = 0;
mem3             18251 ext/sqlite3/libsqlite/sqlite3.c       memsys3Merge(&mem3.aiHash[i]);
mem3             18254 ext/sqlite3/libsqlite/sqlite3.c       memsys3Merge(&mem3.aiSmall[i]);
mem3             18256 ext/sqlite3/libsqlite/sqlite3.c     if( mem3.szMaster ){
mem3             18257 ext/sqlite3/libsqlite/sqlite3.c       memsys3Unlink(mem3.iMaster);
mem3             18258 ext/sqlite3/libsqlite/sqlite3.c       if( mem3.szMaster>=nBlock ){
mem3             18278 ext/sqlite3/libsqlite/sqlite3.c   assert( sqlite3_mutex_held(mem3.mutex) );
mem3             18279 ext/sqlite3/libsqlite/sqlite3.c   assert( p>mem3.aPool && p<&mem3.aPool[mem3.nPool] );
mem3             18280 ext/sqlite3/libsqlite/sqlite3.c   i = p - mem3.aPool;
mem3             18281 ext/sqlite3/libsqlite/sqlite3.c   assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 );
mem3             18282 ext/sqlite3/libsqlite/sqlite3.c   size = mem3.aPool[i-1].u.hdr.size4x/4;
mem3             18283 ext/sqlite3/libsqlite/sqlite3.c   assert( i+size<=mem3.nPool+1 );
mem3             18284 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i-1].u.hdr.size4x &= ~1;
mem3             18285 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i+size-1].u.hdr.prevSize = size;
mem3             18286 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[i+size-1].u.hdr.size4x &= ~2;
mem3             18290 ext/sqlite3/libsqlite/sqlite3.c   if( mem3.iMaster ){
mem3             18291 ext/sqlite3/libsqlite/sqlite3.c     while( (mem3.aPool[mem3.iMaster-1].u.hdr.size4x&2)==0 ){
mem3             18292 ext/sqlite3/libsqlite/sqlite3.c       size = mem3.aPool[mem3.iMaster-1].u.hdr.prevSize;
mem3             18293 ext/sqlite3/libsqlite/sqlite3.c       mem3.iMaster -= size;
mem3             18294 ext/sqlite3/libsqlite/sqlite3.c       mem3.szMaster += size;
mem3             18295 ext/sqlite3/libsqlite/sqlite3.c       memsys3Unlink(mem3.iMaster);
mem3             18296 ext/sqlite3/libsqlite/sqlite3.c       x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
mem3             18297 ext/sqlite3/libsqlite/sqlite3.c       mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
mem3             18298 ext/sqlite3/libsqlite/sqlite3.c       mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
mem3             18300 ext/sqlite3/libsqlite/sqlite3.c     x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2;
mem3             18301 ext/sqlite3/libsqlite/sqlite3.c     while( (mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x&1)==0 ){
mem3             18302 ext/sqlite3/libsqlite/sqlite3.c       memsys3Unlink(mem3.iMaster+mem3.szMaster);
mem3             18303 ext/sqlite3/libsqlite/sqlite3.c       mem3.szMaster += mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x/4;
mem3             18304 ext/sqlite3/libsqlite/sqlite3.c       mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x;
mem3             18305 ext/sqlite3/libsqlite/sqlite3.c       mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster;
mem3             18398 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool = (Mem3Block *)sqlite3GlobalConfig.pHeap;
mem3             18399 ext/sqlite3/libsqlite/sqlite3.c   mem3.nPool = (sqlite3GlobalConfig.nHeap / sizeof(Mem3Block)) - 2;
mem3             18402 ext/sqlite3/libsqlite/sqlite3.c   mem3.szMaster = mem3.nPool;
mem3             18403 ext/sqlite3/libsqlite/sqlite3.c   mem3.mnMaster = mem3.szMaster;
mem3             18404 ext/sqlite3/libsqlite/sqlite3.c   mem3.iMaster = 1;
mem3             18405 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[0].u.hdr.size4x = (mem3.szMaster<<2) + 2;
mem3             18406 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[mem3.nPool].u.hdr.prevSize = mem3.nPool;
mem3             18407 ext/sqlite3/libsqlite/sqlite3.c   mem3.aPool[mem3.nPool].u.hdr.size4x = 1;
mem3             18417 ext/sqlite3/libsqlite/sqlite3.c   mem3.mutex = 0;
mem3             18444 ext/sqlite3/libsqlite/sqlite3.c   for(i=1; i<=mem3.nPool; i+=size/4){
mem3             18445 ext/sqlite3/libsqlite/sqlite3.c     size = mem3.aPool[i-1].u.hdr.size4x;
mem3             18447 ext/sqlite3/libsqlite/sqlite3.c       fprintf(out, "%p size error\n", &mem3.aPool[i]);
mem3             18451 ext/sqlite3/libsqlite/sqlite3.c     if( (size&1)==0 && mem3.aPool[i+size/4-1].u.hdr.prevSize!=size/4 ){
mem3             18452 ext/sqlite3/libsqlite/sqlite3.c       fprintf(out, "%p tail size does not match\n", &mem3.aPool[i]);
mem3             18456 ext/sqlite3/libsqlite/sqlite3.c     if( ((mem3.aPool[i+size/4-1].u.hdr.size4x&2)>>1)!=(size&1) ){
mem3             18457 ext/sqlite3/libsqlite/sqlite3.c       fprintf(out, "%p tail checkout bit is incorrect\n", &mem3.aPool[i]);
mem3             18462 ext/sqlite3/libsqlite/sqlite3.c       fprintf(out, "%p %6d bytes checked out\n", &mem3.aPool[i], (size/4)*8-8);
mem3             18464 ext/sqlite3/libsqlite/sqlite3.c       fprintf(out, "%p %6d bytes free%s\n", &mem3.aPool[i], (size/4)*8-8,
mem3             18465 ext/sqlite3/libsqlite/sqlite3.c                   i==mem3.iMaster ? " **master**" : "");
mem3             18469 ext/sqlite3/libsqlite/sqlite3.c     if( mem3.aiSmall[i]==0 ) continue;
mem3             18471 ext/sqlite3/libsqlite/sqlite3.c     for(j = mem3.aiSmall[i]; j>0; j=mem3.aPool[j].u.list.next){
mem3             18472 ext/sqlite3/libsqlite/sqlite3.c       fprintf(out, " %p(%d)", &mem3.aPool[j],
mem3             18473 ext/sqlite3/libsqlite/sqlite3.c               (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
mem3             18478 ext/sqlite3/libsqlite/sqlite3.c     if( mem3.aiHash[i]==0 ) continue;
mem3             18480 ext/sqlite3/libsqlite/sqlite3.c     for(j = mem3.aiHash[i]; j>0; j=mem3.aPool[j].u.list.next){
mem3             18481 ext/sqlite3/libsqlite/sqlite3.c       fprintf(out, " %p(%d)", &mem3.aPool[j],
mem3             18482 ext/sqlite3/libsqlite/sqlite3.c               (mem3.aPool[j-1].u.hdr.size4x/4)*8-8);
mem3             18486 ext/sqlite3/libsqlite/sqlite3.c   fprintf(out, "master=%d\n", mem3.iMaster);
mem3             18487 ext/sqlite3/libsqlite/sqlite3.c   fprintf(out, "nowUsed=%d\n", mem3.nPool*8 - mem3.szMaster*8);
mem3             18488 ext/sqlite3/libsqlite/sqlite3.c   fprintf(out, "mxUsed=%d\n", mem3.nPool*8 - mem3.mnMaster*8);
mem3             18489 ext/sqlite3/libsqlite/sqlite3.c   sqlite3_mutex_leave(mem3.mutex);