-C Add\ssource\sfile\stest_osinst.c.\sA\swrapper\svfs\swith\sinstrumentation\scapabilities.\s(CVS\s4977)
-D 2008-04-10T14:51:01
+C Make\ssure\sall\smemory\sallocations\sare\s8-byte\saligned.\s\sTicket\s#3040.\nNote\sthat\sthe\smem3.c\smemory\sallocator\sreturns\s4-byte\saligned\smemory\nallocations.\s\sBut\sas\smem3.c\sis\sintended\sfor\suse\sin\s32-bit\sembedded\nsystems,\swe\sare\snot\sgoing\sto\schange\sthat.\s(CVS\s4978)
+D 2008-04-10T14:57:25
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in b861627d91df5ee422c54237aa38296954dc0151
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
F src/malloc.c 12c1ae98ef1eff34b13c9eb526e0b7b479e1e820
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
F src/mem1.c fc716ff521b6dd3e43eaa211967383308800e70a
-F src/mem2.c 84f7ac94dbf55b9ecec85980e74c6f3a87da795d
+F src/mem2.c 3656205111208a847e21d81a1d5b09a010164096
F src/mem3.c 52547678a2ae50c203d54be1a5bf51eb02438a3f
F src/mem4.c 45c328ec6dcb7e8d319cb383615b5fe547ca5409
F src/mem5.c 11d98b76f77873aab86b543cbd1a8ddc4e680d58
F src/vdbe.h f72201a0657d5f3d6cc008d1f8d9cc65768518c9
F src/vdbeInt.h 0b96efdeecb0803e504bf1c16b198f87c91d6019
F src/vdbeapi.c ab6e99f8a6b7fcb82c2c698da7a36762a7593f0a
-F src/vdbeaux.c 519ec819a8e549d087899f0c9a912afcdda762b4
+F src/vdbeaux.c 0aa2d8ede6bdb4379c36491c14d9779221bf196d
F src/vdbeblob.c cc713c142c3d4952b380c98ee035f850830ddbdb
F src/vdbefifo.c a30c237b2a3577e1415fb6e288cbb6b8ed1e5736
F src/vdbemem.c 095e18f84b3171a5f2d71fa93a4bfc64220c1cfe
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 55591fc49c8ab8146c1f3eff733e637501bff627
-R eb917bb84cf56955a047ec767653c982
-U danielk1977
-Z 1f007475942ab467fd58433a4982bf4d
+P d9a6b653d3cb608610f13d2492fe9b3887acb3b9
+R 5abecbe6fddd99e44f6149cafd5e65bd
+U drh
+Z cb5f0994d8c7c4628b79acd85cbbd54d
-d9a6b653d3cb608610f13d2492fe9b3887acb3b9
\ No newline at end of file
+d11e8e307af906db75ae7aede790464fabd06422
\ No newline at end of file
** This file contains the C functions that implement a memory
** allocation subsystem for use by SQLite.
**
-** $Id: mem2.c,v 1.25 2008/04/03 10:13:01 danielk1977 Exp $
+** $Id: mem2.c,v 1.26 2008/04/10 14:57:25 drh Exp $
*/
#include "sqliteInt.h"
** MemBlockHdr.
*/
struct MemBlockHdr {
+ i64 iSize; /* Size of this allocation */
struct MemBlockHdr *pNext, *pPrev; /* Linked list of all unfreed memory */
- int iSize; /* Size of this allocation */
char nBacktrace; /* Number of backtraces on this alloc */
char nBacktraceSlots; /* Available backtrace slots */
short nTitle; /* Bytes of title; includes '\0' */
p = (struct MemBlockHdr*)pAllocation;
p--;
assert( p->iForeGuard==FOREGUARD );
- nReserve = (p->iSize+3)&~3;
+ nReserve = (p->iSize+7)&~7;
pInt = (int*)pAllocation;
pU8 = (u8*)pAllocation;
assert( pInt[nReserve/sizeof(int)]==REARGUARD );
if( mem.alarmCallback!=0 && mem.nowUsed+nByte>=mem.alarmThreshold ){
sqlite3MemsysAlarm(nByte);
}
- nReserve = (nByte+3)&~3;
+ nReserve = (nByte+7)&~7;
if( nReserve/8>NCSIZE-1 ){
mem.sizeCnt[NCSIZE-1]++;
}else{
if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1;
memcpy(mem.zTitle, zTitle, n);
mem.zTitle[n] = 0;
- mem.nTitle = (n+3)&~3;
+ mem.nTitle = (n+7)&~7;
sqlite3_mutex_leave(mem.mutex);
}
for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
char *z = (char*)pHdr;
z -= pHdr->nBacktraceSlots*sizeof(void*) + pHdr->nTitle;
- fprintf(out, "**** %d bytes at %p from %s ****\n",
+ fprintf(out, "**** %lld bytes at %p from %s ****\n",
pHdr->iSize, &pHdr[1], pHdr->nTitle ? z : "???");
if( pHdr->nBacktrace ){
fflush(out);
u32 serial_type, /* Serial type to deserialize */
Mem *pMem /* Memory cell to write value into */
){
+#ifndef SQLITE_MEMORY_SIZE
+ assert( (7&(int)pMem)==0 ); /* Verify 8-byte alignment. Ticket #3040 */
+#endif
switch( serial_type ){
case 10: /* Reserved for future use */
case 11: /* Reserved for future use */
u32 szHdr;
Mem *pMem;
- nByte = sizeof(*p) + sizeof(Mem)*(pKeyInfo->nField+1);
+ assert( sizeof(Mem)>sizeof(*p) );
+ nByte = sizeof(Mem)*(pKeyInfo->nField+2);
if( nByte>szSpace ){
p = sqlite3DbMallocRaw(pKeyInfo->db, nByte);
if( p==0 ) return 0;
p->pKeyInfo = pKeyInfo;
p->nField = pKeyInfo->nField + 1;
p->needDestroy = 1;
- p->aMem = pMem = (Mem*)&p[1];
+ p->aMem = pMem = &((Mem*)p)[1];
idx = GetVarint(aKey, szHdr);
d = szHdr;
i = 0;