/ Check-in [bbaec351]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Avoid overriding the malloc_usable_size symbol using the C preprocessor as this might be confusing the build on some systems.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: bbaec351dd7784fd0af24b916110844176810f82
User & Date: drh 2012-01-18 18:22:44
Context
2012-01-19
16:57
Make the use and function of SQLITE_DYNAMIC clearer. Add assert() statement to help ensure that SQLITE_DYNAMIC is not misused. check-in: ab80f2c3 user: drh tags: trunk
2012-01-18
18:22
Avoid overriding the malloc_usable_size symbol using the C preprocessor as this might be confusing the build on some systems. check-in: bbaec351 user: drh tags: trunk
12:46
Add the SQLITE_WITHOUT_MSIZE and SQLITE_WITHOUT_ZONEMALLOC macros in mem1.c to disable the use of _msize() on windows and the zone memory allocator on Apple products, respectively. check-in: 238e35a4 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/mem1.c.

    58     58   ** Windows systems have malloc_usable_size() but it is called _msize().
    59     59   ** The use of _msize() is automatic, but can be disabled by compiling
    60     60   ** with -DSQLITE_WITHOUT_MSIZE
    61     61   */
    62     62   #if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN \
    63     63         && !defined(SQLITE_WITHOUT_MSIZE)
    64     64   # define HAVE_MALLOC_USABLE_SIZE 1
    65         -# define malloc_usable_size _msize
           65  +# define SQLITE_MALLOCSIZE _msize
    66     66   #endif
    67     67   
    68     68   #if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC)
    69     69   
    70     70   /*
    71     71   ** Use the zone allocator available on apple products unless the
    72     72   ** SQLITE_WITHOUT_ZONEMALLOC symbol is defined.
................................................................................
    88     88   ** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined.
    89     89   */
    90     90   #define SQLITE_MALLOC(x)    malloc(x)
    91     91   #define SQLITE_FREE(x)      free(x)
    92     92   #define SQLITE_REALLOC(x,y) realloc((x),(y))
    93     93   
    94     94   #ifdef HAVE_MALLOC_USABLE_SIZE
    95         -#include <malloc.h>
    96         -#define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
           95  +# ifndef SQLITE_MALLOCSIZE
           96  +#  include <malloc.h>
           97  +#  define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
           98  +# endif
    97     99   #else
    98         -#undef SQLITE_MALLOCSIZE
          100  +# undef SQLITE_MALLOCSIZE
    99    101   #endif
   100    102   
   101    103   #endif /* __APPLE__ or not __APPLE__ */
   102    104   
   103    105   /*
   104    106   ** Like malloc(), but remember the size of the allocation
   105    107   ** so that we can find it later using sqlite3MemSize().