OLD | NEW |
1 /* | 1 /* |
2 ** 2007 October 14 | 2 ** 2007 October 14 |
3 ** | 3 ** |
4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
6 ** | 6 ** |
7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
10 ** | 10 ** |
11 ************************************************************************* | 11 ************************************************************************* |
12 ** This file contains the C functions that implement a memory | 12 ** This file contains the C functions that implement a memory |
13 ** allocation subsystem for use by SQLite. | 13 ** allocation subsystem for use by SQLite. |
14 ** | 14 ** |
15 ** This version of the memory allocation subsystem omits all | 15 ** This version of the memory allocation subsystem omits all |
16 ** use of malloc(). The SQLite user supplies a block of memory | 16 ** use of malloc(). The SQLite user supplies a block of memory |
17 ** before calling sqlite3_initialize() from which allocations | 17 ** before calling sqlite3_initialize() from which allocations |
18 ** are made and returned by the xMalloc() and xRealloc() | 18 ** are made and returned by the xMalloc() and xRealloc() |
19 ** implementations. Once sqlite3_initialize() has been called, | 19 ** implementations. Once sqlite3_initialize() has been called, |
20 ** the amount of memory available to SQLite is fixed and cannot | 20 ** the amount of memory available to SQLite is fixed and cannot |
21 ** be changed. | 21 ** be changed. |
22 ** | 22 ** |
23 ** This version of the memory allocation subsystem is included | 23 ** This version of the memory allocation subsystem is included |
24 ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. | 24 ** in the build only if SQLITE_ENABLE_MEMSYS3 is defined. |
25 ** | |
26 ** $Id: mem3.c,v 1.25 2008/11/19 16:52:44 danielk1977 Exp $ | |
27 */ | 25 */ |
28 #include "sqliteInt.h" | 26 #include "sqliteInt.h" |
29 | 27 |
30 /* | 28 /* |
31 ** This version of the memory allocator is only built into the library | 29 ** This version of the memory allocator is only built into the library |
32 ** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not | 30 ** SQLITE_ENABLE_MEMSYS3 is defined. Defining this symbol does not |
33 ** mean that the library will use a memory-pool by default, just that | 31 ** mean that the library will use a memory-pool by default, just that |
34 ** it is available. The mempool allocator is activated by calling | 32 ** it is available. The mempool allocator is activated by calling |
35 ** sqlite3_config(). | 33 ** sqlite3_config(). |
36 */ | 34 */ |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 mem3.aPool[mem3.nPool].u.hdr.size4x = 1; | 569 mem3.aPool[mem3.nPool].u.hdr.size4x = 1; |
572 | 570 |
573 return SQLITE_OK; | 571 return SQLITE_OK; |
574 } | 572 } |
575 | 573 |
576 /* | 574 /* |
577 ** Deinitialize this module. | 575 ** Deinitialize this module. |
578 */ | 576 */ |
579 static void memsys3Shutdown(void *NotUsed){ | 577 static void memsys3Shutdown(void *NotUsed){ |
580 UNUSED_PARAMETER(NotUsed); | 578 UNUSED_PARAMETER(NotUsed); |
| 579 mem3.mutex = 0; |
581 return; | 580 return; |
582 } | 581 } |
583 | 582 |
584 | 583 |
585 | 584 |
586 /* | 585 /* |
587 ** Open the file indicated and write a log of all unfreed memory | 586 ** Open the file indicated and write a log of all unfreed memory |
588 ** allocations into that log. | 587 ** allocations into that log. |
589 */ | 588 */ |
590 void sqlite3Memsys3Dump(const char *zFilename){ | 589 void sqlite3Memsys3Dump(const char *zFilename){ |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 memsys3Size, | 678 memsys3Size, |
680 memsys3Roundup, | 679 memsys3Roundup, |
681 memsys3Init, | 680 memsys3Init, |
682 memsys3Shutdown, | 681 memsys3Shutdown, |
683 0 | 682 0 |
684 }; | 683 }; |
685 return &mempoolMethods; | 684 return &mempoolMethods; |
686 } | 685 } |
687 | 686 |
688 #endif /* SQLITE_ENABLE_MEMSYS3 */ | 687 #endif /* SQLITE_ENABLE_MEMSYS3 */ |
OLD | NEW |