Despite of the following comment in mem1.c:
<http://www.sqlite.org/src/artifact/437c7c4af9?ln=54-56>
on Windows the _msize() function is not used at all,
neither on MSVC neither on MinGW.
The problem is that at the end of the @ifdef'ery, when
HAVE_MALLOC_USABLE_SIZE is not defined,
SQLITE_MALLOCSIZE is undefined. That undoes
everything useful done earlier.
There are various ways to fix this, here is mine.
I hope this fix is in time for SQLite 3.8.2.
Regards,
Jan Nijtmans
==================================================================
Index: src/mem1.c
==================================================================
--- src/mem1.c
+++ src/mem1.c
@@ -53,12 +53,14 @@
/*
** The MSVCRT has malloc_usable_size() but it is called _msize().
** The use of _msize() is automatic, but can be disabled by compiling
** with -DSQLITE_WITHOUT_MSIZE
*/
-#if defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)
+#if defined(_WIN32) && !defined(SQLITE_WITHOUT_MSIZE)
# define SQLITE_MALLOCSIZE _msize
+#elif defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE)
+# define SQLITE_MALLOCSIZE malloc_usable_size
#endif
#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
/*
@@ -83,21 +85,13 @@
*/
#define SQLITE_MALLOC(x) malloc(x)
#define SQLITE_FREE(x) free(x)
#define SQLITE_REALLOC(x,y) realloc((x),(y))
-#if (defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE)) \
- || (defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE))
+#if defined(SQLITE_MALLOCSIZE)
# include <malloc.h> /* Needed for malloc_usable_size on linux */
#endif
-#ifdef HAVE_MALLOC_USABLE_SIZE
-# ifndef SQLITE_MALLOCSIZE
-# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
-# endif
-#else
-# undef SQLITE_MALLOCSIZE
-#endif
#endif /* __APPLE__ or not __APPLE__ */
/*
** Like malloc(), but remember the size of the allocation
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users