Latest version of Sqlite (3.7.10) wanted to link __msize function and since Delphi memory manager can not report the size of a memory block, I had to introduce a hack (d5 compatible)
function __msize(p: pointer): Cardinal;cdecl;
begin
Result:=PInteger(integer(p)-4)^-6;
end;
Are there other solutions inside Sqlite (defines?) or Delphi to fix this so no undocumented features are used.
You can use SizeOfMem from JCL JclSysUtils unit.
Around line # 15195 in the source code, comment the following lines:
/*
** Windows systems have malloc_usable_size() but it is called _msize()
*/
#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
# define HAVE_MALLOC_USABLE_SIZE 1
# define malloc_usable_size _msize
#endif
into
/*
** Windows systems have malloc_usable_size() but it is called _msize()
#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
# define HAVE_MALLOC_USABLE_SIZE 1
# define malloc_usable_size _msize
#endif
*/
It will disable the memory reuse of SQLite3 malloc, and will rely on the better FastMM4 reallocmem() implementation.
See this commit e.g. for our Open Source implementation of SQLite3 static linking.
Additional information:
I think that we'd get rid of this issue in 3.7.11, as stated by this commit: a new SQLITE_WITHOUT_MSIZE
global symbol will be added, and will be able to build the amalgamation source code without changing its content, just by setting the appropriate SQLITE_WITHOUT_MSIZE
define. In the meanwhile, the easiest is to comment the above lines.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With