Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change non-exported memory interfaces to following the naming conventions. (CVS 4797) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
94774b41429c8bfa3582e30c09f414b9 |
User & Date: | drh 2008-02-19 15:15:16.000 |
Context
2008-02-19
| ||
15:20 | Make sure SQLITE_OPEN_DELETEONCLOSE is ignored by sqlite3_open_v2(). (CVS 4798) (check-in: 33e26f6adf user: drh tags: trunk) | |
15:15 | Change non-exported memory interfaces to following the naming conventions. (CVS 4797) (check-in: 94774b4142 user: drh tags: trunk) | |
14:59 | Use 16-bit integers for indexing within a page in btree. Tighter bounds on the maximum number of cells within one page. (CVS 4796) (check-in: 8fdbe4abab user: drh tags: trunk) | |
Changes
Changes to src/mem2.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the C functions that implement a memory ** allocation subsystem for use by SQLite. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the C functions that implement a memory ** allocation subsystem for use by SQLite. ** ** $Id: mem2.c,v 1.22 2008/02/19 15:15:16 drh Exp $ */ #include "sqliteInt.h" /* ** This version of the memory allocator is used only if the ** SQLITE_MEMDEBUG macro is defined */ |
︙ | ︙ | |||
378 379 380 381 382 383 384 | } /* ** Set the number of backtrace levels kept for each allocation. ** A value of zero turns of backtracing. The number is always rounded ** up to a multiple of 2. */ | | | | | 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 | } /* ** Set the number of backtrace levels kept for each allocation. ** A value of zero turns of backtracing. The number is always rounded ** up to a multiple of 2. */ void sqlite3MemdebugBacktrace(int depth){ if( depth<0 ){ depth = 0; } if( depth>20 ){ depth = 20; } depth = (depth+1)&0xfe; mem.nBacktrace = depth; } /* ** Set the title string for subsequent allocations. */ void sqlite3MemdebugSettitle(const char *zTitle){ int n = strlen(zTitle) + 1; enterMem(); if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1; memcpy(mem.zTitle, zTitle, n); mem.zTitle[n] = 0; mem.nTitle = (n+3)&~3; sqlite3_mutex_leave(mem.mutex); } /* ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ void sqlite3MemdebugDump(const char *zFilename){ FILE *out; struct MemBlockHdr *pHdr; void **pBt; int i; out = fopen(zFilename, "w"); if( out==0 ){ fprintf(stderr, "** Unable to output memory debug output log: %s **\n", |
︙ | ︙ | |||
441 442 443 444 445 446 447 | } fclose(out); } /* ** Return the number of times sqlite3_malloc() has been called. */ | | | 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 | } fclose(out); } /* ** Return the number of times sqlite3_malloc() has been called. */ int sqlite3MemdebugMallocCount(){ int i; int nTotal = 0; for(i=0; i<NCSIZE; i++){ nTotal += mem.sizeCnt[i]; } return nTotal; } #endif /* SQLITE_MEMDEBUG */ |
Changes to src/mem3.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 | ** use of malloc(). All dynamically allocatable memory is ** contained in a static array, mem.aPool[]. The size of this ** fixed memory pool is SQLITE_MEMORY_SIZE bytes. ** ** This version of the memory allocation subsystem is used if ** and only if SQLITE_MEMORY_SIZE is defined. ** | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ** use of malloc(). All dynamically allocatable memory is ** contained in a static array, mem.aPool[]. The size of this ** fixed memory pool is SQLITE_MEMORY_SIZE bytes. ** ** This version of the memory allocation subsystem is used if ** and only if SQLITE_MEMORY_SIZE is defined. ** ** $Id: mem3.c,v 1.12 2008/02/19 15:15:16 drh Exp $ */ #include "sqliteInt.h" /* ** This version of the memory allocator is used only when ** SQLITE_MEMORY_SIZE is defined. */ |
︙ | ︙ | |||
574 575 576 577 578 579 580 | return p; } /* ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ | | | 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 | return p; } /* ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ void sqlite3MemdebugDump(const char *zFilename){ #ifdef SQLITE_DEBUG FILE *out; int i, j; u32 size; if( zFilename==0 || zFilename[0]==0 ){ out = stdout; }else{ |
︙ | ︙ |
Changes to src/mem5.c.
︙ | ︙ | |||
16 17 18 19 20 21 22 | ** use of malloc(). All dynamically allocatable memory is ** contained in a static array, mem.aPool[]. The size of this ** fixed memory pool is SQLITE_POW2_MEMORY_SIZE bytes. ** ** This version of the memory allocation subsystem is used if ** and only if SQLITE_POW2_MEMORY_SIZE is defined. ** | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ** use of malloc(). All dynamically allocatable memory is ** contained in a static array, mem.aPool[]. The size of this ** fixed memory pool is SQLITE_POW2_MEMORY_SIZE bytes. ** ** This version of the memory allocation subsystem is used if ** and only if SQLITE_POW2_MEMORY_SIZE is defined. ** ** $Id: mem5.c,v 1.4 2008/02/19 15:15:16 drh Exp $ */ #include "sqliteInt.h" /* ** This version of the memory allocator is used only when ** SQLITE_POW2_MEMORY_SIZE is defined. */ |
︙ | ︙ | |||
466 467 468 469 470 471 472 | return p; } /* ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ | | | 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 | return p; } /* ** Open the file indicated and write a log of all unfreed memory ** allocations into that log. */ void sqlite3MemdebugDump(const char *zFilename){ #ifdef SQLITE_DEBUG FILE *out; int i, j, n; if( zFilename==0 || zFilename[0]==0 ){ out = stdout; }else{ |
︙ | ︙ |
Changes to src/test_malloc.c.
︙ | ︙ | |||
9 10 11 12 13 14 15 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code used to implement test interfaces to the ** memory allocation subsystem. ** | | | 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code used to implement test interfaces to the ** memory allocation subsystem. ** ** $Id: test_malloc.c,v 1.15 2008/02/19 15:15:16 drh Exp $ */ #include "sqliteInt.h" #include "tcl.h" #include <stdlib.h> #include <string.h> #include <assert.h> |
︙ | ︙ | |||
308 309 310 311 312 313 314 | if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "DEPT"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[1], &depth) ) return TCL_ERROR; #ifdef SQLITE_MEMDEBUG { | | | | 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "DEPT"); return TCL_ERROR; } if( Tcl_GetIntFromObj(interp, objv[1], &depth) ) return TCL_ERROR; #ifdef SQLITE_MEMDEBUG { extern void sqlite3MemdebugBacktrace(int); sqlite3MemdebugBacktrace(depth); } #endif return TCL_OK; } /* ** Usage: sqlite3_memdebug_dump FILENAME |
︙ | ︙ | |||
333 334 335 336 337 338 339 | if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); return TCL_ERROR; } #if defined(SQLITE_MEMDEBUG) || defined(SQLITE_MEMORY_SIZE) \ || defined(SQLITE_POW2_MEMORY_SIZE) { | | | | 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 | if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "FILENAME"); return TCL_ERROR; } #if defined(SQLITE_MEMDEBUG) || defined(SQLITE_MEMORY_SIZE) \ || defined(SQLITE_POW2_MEMORY_SIZE) { extern void sqlite3MemdebugDump(const char*); sqlite3MemdebugDump(Tcl_GetString(objv[1])); } #endif return TCL_OK; } /* ** Usage: sqlite3_memdebug_malloc_count |
︙ | ︙ | |||
358 359 360 361 362 363 364 | int nMalloc = -1; if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } #if defined(SQLITE_MEMDEBUG) { | | | | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | int nMalloc = -1; if( objc!=1 ){ Tcl_WrongNumArgs(interp, 1, objv, ""); return TCL_ERROR; } #if defined(SQLITE_MEMDEBUG) { extern int sqlite3MemdebugMallocCount(); nMalloc = sqlite3MemdebugMallocCount(); } #endif Tcl_SetObjResult(interp, Tcl_NewIntObj(nMalloc)); return TCL_OK; } |
︙ | ︙ | |||
499 500 501 502 503 504 505 | if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "TITLE"); return TCL_ERROR; } zTitle = Tcl_GetString(objv[1]); #ifdef SQLITE_MEMDEBUG { | | | | 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | if( objc!=2 ){ Tcl_WrongNumArgs(interp, 1, objv, "TITLE"); return TCL_ERROR; } zTitle = Tcl_GetString(objv[1]); #ifdef SQLITE_MEMDEBUG { extern int sqlite3MemdebugSettitle(const char*); sqlite3MemdebugSettitle(zTitle); } #endif return TCL_OK; } /* |
︙ | ︙ |