Sqlite 3.7.10 and static communication in Delphi

The latest version of Sqlite (3.7.10) wanted to bind the __msize function, and since the Delphi memory manager cannot tell the size of the memory block, I had to enter a hacked (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 undocumented functions are not used.

+4
source share
2 answers

Around line # 15195 in the source code, comment on 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 

in

 /* ** 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 SQLite3 malloc memory reuse and will rely on the best implementation of FastMM4 reallocmem ().

See this commit , for example. for our open source implementation of SQLite3 static binding.

Additional Information:

I think we will get rid of this problem in 3.7.11, as indicated by this commit : a new SQLITE_WITHOUT_MSIZE global symbol will be added, and it will be able to create the amalgamation source code without changing its contents, simply by setting the appropriate SQLITE_WITHOUT_MSIZE define. At the same time, the easiest way is to comment on the lines above.

+8
source

You can use SizeOfMem from JCL JclSysUtils .

+2
source

Source: https://habr.com/ru/post/1391611/


All Articles