| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2008 Jan 22 | 2 ** 2008 Jan 22 |
| 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 ** | 12 ** |
| 13 ** $Id: fault.c,v 1.11 2008/09/02 00:52:52 drh Exp $ | |
| 14 */ | |
| 15 | |
| 16 /* | |
| 17 ** This file contains code to support the concept of "benign" | 13 ** This file contains code to support the concept of "benign" |
| 18 ** malloc failures (when the xMalloc() or xRealloc() method of the | 14 ** malloc failures (when the xMalloc() or xRealloc() method of the |
| 19 ** sqlite3_mem_methods structure fails to allocate a block of memory | 15 ** sqlite3_mem_methods structure fails to allocate a block of memory |
| 20 ** and returns 0). | 16 ** and returns 0). |
| 21 ** | 17 ** |
| 22 ** Most malloc failures are non-benign. After they occur, SQLite | 18 ** Most malloc failures are non-benign. After they occur, SQLite |
| 23 ** abandons the current operation and returns an error code (usually | 19 ** abandons the current operation and returns an error code (usually |
| 24 ** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily | 20 ** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily |
| 25 ** fatal. For example, if a malloc fails while resizing a hash table, this | 21 ** fatal. For example, if a malloc fails while resizing a hash table, this |
| 26 ** is completely recoverable simply by not carrying out the resize. The | 22 ** is completely recoverable simply by not carrying out the resize. The |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 78 } |
| 83 } | 79 } |
| 84 void sqlite3EndBenignMalloc(void){ | 80 void sqlite3EndBenignMalloc(void){ |
| 85 wsdHooksInit; | 81 wsdHooksInit; |
| 86 if( wsdHooks.xBenignEnd ){ | 82 if( wsdHooks.xBenignEnd ){ |
| 87 wsdHooks.xBenignEnd(); | 83 wsdHooks.xBenignEnd(); |
| 88 } | 84 } |
| 89 } | 85 } |
| 90 | 86 |
| 91 #endif /* #ifndef SQLITE_OMIT_BUILTIN_TEST */ | 87 #endif /* #ifndef SQLITE_OMIT_BUILTIN_TEST */ |
| OLD | NEW |