mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-15 11:41:13 +03:00
Allow the Win32 native heap flags to be overridden at compile-time.
FossilOrigin-Name: 1c2ecec8e7320bc5b532b3107005fb7f0370f25c
This commit is contained in:
12
manifest
12
manifest
@@ -1,5 +1,5 @@
|
|||||||
C Add\scomments\sfor\sthe\svarious\sdebug\slevels.\s\sWhen\sdebugging,\sdisable\soptimizations.\s\sPrevent\sthe\swin32lock\stests\sfrom\sspinning\sforever.
|
C Allow\sthe\sWin32\snative\sheap\sflags\sto\sbe\soverridden\sat\scompile-time.
|
||||||
D 2011-08-25T04:09:12.308
|
D 2011-08-26T01:32:24.991
|
||||||
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
|
||||||
F Makefile.in 8c930e7b493d59099ea1304bd0f2aed152eb3315
|
F Makefile.in 8c930e7b493d59099ea1304bd0f2aed152eb3315
|
||||||
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
|
||||||
@@ -166,7 +166,7 @@ F src/os.h 9dbed8c2b9c1f2f2ebabc09e49829d4777c26bf9
|
|||||||
F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58
|
F src/os_common.h 65a897143b64667d23ed329a7984b9b405accb58
|
||||||
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
F src/os_os2.c 4a75888ba3dfc820ad5e8177025972d74d7f2440
|
||||||
F src/os_unix.c 81341980c52a44106b10c1e28a0d5c5247476452
|
F src/os_unix.c 81341980c52a44106b10c1e28a0d5c5247476452
|
||||||
F src/os_win.c 7d27ec1e65069d7ce8d698a475cc3550b8dbae15
|
F src/os_win.c dc2e61b0727989a796482471e1e9caab890005ea
|
||||||
F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41
|
F src/pager.c 120550e7ef01dafaa2cbb4a0528c0d87c8f12b41
|
||||||
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
|
F src/pager.h 3f8c783de1d4706b40b1ac15b64f5f896bcc78d1
|
||||||
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
F src/parse.y 12b7ebd61ea54f0e1b1083ff69cc2c8ce9353d58
|
||||||
@@ -961,7 +961,7 @@ F tool/symbols.sh caaf6ccc7300fd43353318b44524853e222557d5
|
|||||||
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
|
F tool/tostr.awk 11760e1b94a5d3dcd42378f3cc18544c06cfa576
|
||||||
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
|
||||||
F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2
|
F tool/warnings.sh b7fdb2cc525f5ef4fa43c80e771636dd3690f9d2
|
||||||
P 4257e9b7ca78feb03df08fde56da947ae64c5c6f
|
P 401859236b0d97bde82b11f32efce6eb9d490941
|
||||||
R 0448fba2024f79c072babb8ddd4d7080
|
R 35801e696f9647a4182ac9bf0b1942c5
|
||||||
U mistachkin
|
U mistachkin
|
||||||
Z d666bad4d643507c471d1b757fa63134
|
Z affee667f35124b9dd9a06a0543d989b
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
401859236b0d97bde82b11f32efce6eb9d490941
|
1c2ecec8e7320bc5b532b3107005fb7f0370f25c
|
||||||
37
src/os_win.c
37
src/os_win.c
@@ -139,6 +139,14 @@ struct winFile {
|
|||||||
# define SQLITE_WIN32_HEAP_MAX_SIZE (0)
|
# define SQLITE_WIN32_HEAP_MAX_SIZE (0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The extra flags to use in calls to the Win32 heap APIs. This value may be
|
||||||
|
* zero for the default behavior.
|
||||||
|
*/
|
||||||
|
#ifndef SQLITE_WIN32_HEAP_FLAGS
|
||||||
|
# define SQLITE_WIN32_HEAP_FLAGS (0)
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The winMemData structure stores information required by the Win32-specific
|
** The winMemData structure stores information required by the Win32-specific
|
||||||
** sqlite3_mem_methods implementation.
|
** sqlite3_mem_methods implementation.
|
||||||
@@ -232,10 +240,10 @@ static void *winMemMalloc(int nBytes){
|
|||||||
assert( hHeap!=0 );
|
assert( hHeap!=0 );
|
||||||
assert( hHeap!=INVALID_HANDLE_VALUE );
|
assert( hHeap!=INVALID_HANDLE_VALUE );
|
||||||
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
||||||
assert ( HeapValidate(hHeap, 0, NULL) );
|
assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
|
||||||
#endif
|
#endif
|
||||||
assert( nBytes>=0 );
|
assert( nBytes>=0 );
|
||||||
p = HeapAlloc(hHeap, 0, (SIZE_T)nBytes);
|
p = HeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
|
||||||
if( !p ){
|
if( !p ){
|
||||||
sqlite3_log(SQLITE_NOMEM, "failed to HeapAlloc %u bytes (%d), heap=%p",
|
sqlite3_log(SQLITE_NOMEM, "failed to HeapAlloc %u bytes (%d), heap=%p",
|
||||||
nBytes, GetLastError(), (void*)hHeap);
|
nBytes, GetLastError(), (void*)hHeap);
|
||||||
@@ -254,10 +262,10 @@ static void winMemFree(void *pPrior){
|
|||||||
assert( hHeap!=0 );
|
assert( hHeap!=0 );
|
||||||
assert( hHeap!=INVALID_HANDLE_VALUE );
|
assert( hHeap!=INVALID_HANDLE_VALUE );
|
||||||
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
||||||
assert ( HeapValidate(hHeap, 0, pPrior) );
|
assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
|
||||||
#endif
|
#endif
|
||||||
if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
|
if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */
|
||||||
if( !HeapFree(hHeap, 0, pPrior) ){
|
if( !HeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){
|
||||||
sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%d), heap=%p",
|
sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%d), heap=%p",
|
||||||
pPrior, GetLastError(), (void*)hHeap);
|
pPrior, GetLastError(), (void*)hHeap);
|
||||||
}
|
}
|
||||||
@@ -275,13 +283,13 @@ static void *winMemRealloc(void *pPrior, int nBytes){
|
|||||||
assert( hHeap!=0 );
|
assert( hHeap!=0 );
|
||||||
assert( hHeap!=INVALID_HANDLE_VALUE );
|
assert( hHeap!=INVALID_HANDLE_VALUE );
|
||||||
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
||||||
assert ( HeapValidate(hHeap, 0, pPrior) );
|
assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) );
|
||||||
#endif
|
#endif
|
||||||
assert( nBytes>=0 );
|
assert( nBytes>=0 );
|
||||||
if( !pPrior ){
|
if( !pPrior ){
|
||||||
p = HeapAlloc(hHeap, 0, (SIZE_T)nBytes);
|
p = HeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes);
|
||||||
}else{
|
}else{
|
||||||
p = HeapReAlloc(hHeap, 0, pPrior, (SIZE_T)nBytes);
|
p = HeapReAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior, (SIZE_T)nBytes);
|
||||||
}
|
}
|
||||||
if( !p ){
|
if( !p ){
|
||||||
sqlite3_log(SQLITE_NOMEM, "failed to %s %u bytes (%d), heap=%p",
|
sqlite3_log(SQLITE_NOMEM, "failed to %s %u bytes (%d), heap=%p",
|
||||||
@@ -303,10 +311,10 @@ static int winMemSize(void *p){
|
|||||||
assert( hHeap!=0 );
|
assert( hHeap!=0 );
|
||||||
assert( hHeap!=INVALID_HANDLE_VALUE );
|
assert( hHeap!=INVALID_HANDLE_VALUE );
|
||||||
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
||||||
assert ( HeapValidate(hHeap, 0, NULL) );
|
assert ( HeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
|
||||||
#endif
|
#endif
|
||||||
if( !p ) return 0;
|
if( !p ) return 0;
|
||||||
n = HeapSize(hHeap, 0, p);
|
n = HeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p);
|
||||||
if( n==(SIZE_T)-1 ){
|
if( n==(SIZE_T)-1 ){
|
||||||
sqlite3_log(SQLITE_NOMEM, "failed to HeapSize block %p (%d), heap=%p",
|
sqlite3_log(SQLITE_NOMEM, "failed to HeapSize block %p (%d), heap=%p",
|
||||||
p, GetLastError(), (void*)hHeap);
|
p, GetLastError(), (void*)hHeap);
|
||||||
@@ -331,12 +339,13 @@ static int winMemInit(void *pAppData){
|
|||||||
if( !pWinMemData ) return SQLITE_ERROR;
|
if( !pWinMemData ) return SQLITE_ERROR;
|
||||||
assert( pWinMemData->magic==WINMEM_MAGIC );
|
assert( pWinMemData->magic==WINMEM_MAGIC );
|
||||||
if( !pWinMemData->hHeap ){
|
if( !pWinMemData->hHeap ){
|
||||||
pWinMemData->hHeap = HeapCreate(0, SQLITE_WIN32_HEAP_INIT_SIZE,
|
pWinMemData->hHeap = HeapCreate(SQLITE_WIN32_HEAP_FLAGS,
|
||||||
|
SQLITE_WIN32_HEAP_INIT_SIZE,
|
||||||
SQLITE_WIN32_HEAP_MAX_SIZE);
|
SQLITE_WIN32_HEAP_MAX_SIZE);
|
||||||
if( !pWinMemData->hHeap ){
|
if( !pWinMemData->hHeap ){
|
||||||
sqlite3_log(SQLITE_NOMEM,
|
sqlite3_log(SQLITE_NOMEM,
|
||||||
"failed to HeapCreate (%d), initSize=%u, maxSize=%u",
|
"failed to HeapCreate (%d), flags=%u, initSize=%u, maxSize=%u",
|
||||||
GetLastError(), SQLITE_WIN32_HEAP_INIT_SIZE,
|
GetLastError(), SQLITE_WIN32_HEAP_FLAGS, SQLITE_WIN32_HEAP_INIT_SIZE,
|
||||||
SQLITE_WIN32_HEAP_MAX_SIZE);
|
SQLITE_WIN32_HEAP_MAX_SIZE);
|
||||||
return SQLITE_NOMEM;
|
return SQLITE_NOMEM;
|
||||||
}
|
}
|
||||||
@@ -345,7 +354,7 @@ static int winMemInit(void *pAppData){
|
|||||||
assert( pWinMemData->hHeap!=0 );
|
assert( pWinMemData->hHeap!=0 );
|
||||||
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
|
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
|
||||||
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
||||||
assert( HeapValidate(pWinMemData->hHeap, 0, NULL) );
|
assert( HeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
|
||||||
#endif
|
#endif
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
@@ -360,7 +369,7 @@ static void winMemShutdown(void *pAppData){
|
|||||||
if( pWinMemData->hHeap ){
|
if( pWinMemData->hHeap ){
|
||||||
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
|
assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE );
|
||||||
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
#ifdef SQLITE_WIN32_MALLOC_VALIDATE
|
||||||
assert( HeapValidate(pWinMemData->hHeap, 0, NULL) );
|
assert( HeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) );
|
||||||
#endif
|
#endif
|
||||||
if( pWinMemData->bOwned ){
|
if( pWinMemData->bOwned ){
|
||||||
if( !HeapDestroy(pWinMemData->hHeap) ){
|
if( !HeapDestroy(pWinMemData->hHeap) ){
|
||||||
|
|||||||
Reference in New Issue
Block a user