Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Changes to memory allocator usage tracking to delay the onset of integer overflow. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4e33a0eaf83922926f8d5ee988a20439 |
User & Date: | drh 2011-04-15 16:39:52.779 |
References
2011-05-05
| ||
17:00 | Fix a bug in memory usage tracking that was introduced by check-in [4e33a0eaf83922]. (check-in: 8ba456ae0b user: drh tags: trunk) | |
Context
2011-04-15
| ||
19:30 | Remove stray semi-colon that MSVC complained about. (check-in: 7a085271ff user: shaneh tags: trunk) | |
16:39 | Changes to memory allocator usage tracking to delay the onset of integer overflow. (check-in: 4e33a0eaf8 user: drh tags: trunk) | |
14:46 | Do not do full table scans of unordered indices. (check-in: a8761a9128 user: drh tags: trunk) | |
Changes
Changes to src/malloc.c.
︙ | ︙ | |||
262 263 264 265 266 267 268 | int nFull; void *p; assert( sqlite3_mutex_held(mem0.mutex) ); nFull = sqlite3GlobalConfig.m.xRoundup(n); sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, n); if( mem0.alarmCallback!=0 ){ int nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); | | | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 | int nFull; void *p; assert( sqlite3_mutex_held(mem0.mutex) ); nFull = sqlite3GlobalConfig.m.xRoundup(n); sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, n); if( mem0.alarmCallback!=0 ){ int nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); if( nUsed >= mem0.alarmThreshold - nFull ){ mem0.nearlyFull = 1; sqlite3MallocAlarm(nFull); }else{ mem0.nearlyFull = 0; } } p = sqlite3GlobalConfig.m.xMalloc(nFull); |
︙ | ︙ | |||
503 504 505 506 507 508 509 | sqlite3_free(p); } /* ** Change the size of an existing memory allocation */ void *sqlite3Realloc(void *pOld, int nBytes){ | | | 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 | sqlite3_free(p); } /* ** Change the size of an existing memory allocation */ void *sqlite3Realloc(void *pOld, int nBytes){ int nOld, nNew, nDiff;; void *pNew; if( pOld==0 ){ return sqlite3Malloc(nBytes); /* IMP: R-28354-25769 */ } if( nBytes<=0 ){ sqlite3_free(pOld); /* IMP: R-31593-10574 */ return 0; |
︙ | ︙ | |||
526 527 528 529 530 531 532 | ** xRoundup. */ nNew = sqlite3GlobalConfig.m.xRoundup(nBytes); if( nOld==nNew ){ pNew = pOld; }else if( sqlite3GlobalConfig.bMemstat ){ sqlite3_mutex_enter(mem0.mutex); sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, nBytes); | > | | | | 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 | ** xRoundup. */ nNew = sqlite3GlobalConfig.m.xRoundup(nBytes); if( nOld==nNew ){ pNew = pOld; }else if( sqlite3GlobalConfig.bMemstat ){ sqlite3_mutex_enter(mem0.mutex); sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, nBytes); nDiff = nNew - nOld; if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >= mem0.alarmThreshold-nDiff ){ sqlite3MallocAlarm(nNew-nOld); } assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) ); assert( sqlite3MemdebugNoType(pOld, ~MEMTYPE_HEAP) ); pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); if( pNew==0 && mem0.alarmCallback ){ sqlite3MallocAlarm(nBytes); pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); } if( pNew ){ nNew = sqlite3MallocSize(pNew); sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nDiff); } sqlite3_mutex_leave(mem0.mutex); }else{ pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); } assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-04675-44850 */ return pNew; |
︙ | ︙ |