On Tue, Jan 17, 2012 at 6:11 PM, Max Vlasov <max.vla...@gmail.com> wrote:

> Hi,
> I'm using static linking with Delphi and a new function required binding
> in 3.7.10 - msize (__msize). The problem here is that there's no official
> way to query the size of a memory block in Delphi memory manager, at least
> I'm not aware of one. Should I solve this anyway (for example by keeping my
> own list of blocks and their sizes) or is there some other solution
> (enabled/disable some define)?
>

Quoting and answering myself )

CMIIW, but it seems that HAVE_MALLOC_USABLE_SIZE can't control anything on
Windows. As I suppose it's a new define introduced in 3.7.10

Although there are plenty of lines where #ifdef SQLITE_MALLOCSIZE assumes
there's a possibility that it either exists or not, but if I don't define
anything these lines forces HAVE_MALLOC_USABLE_SIZE to 1 on windows
// ------------------
#if !defined(    HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN
# define HAVE_MALLOC_USABLE_SIZE 1
# define malloc_usable_size _msize
#endif
// ------------------

But looks like on other platforms the define is effective  ( because "....
&& SQLITE_OS_WIN" makes this forcing disabled) and the following line obeys
the setting afterwards
//---------------------
#ifdef HAVE_MALLOC_USABLE_SIZE
#include <malloc.h>
#define SQLITE_MALLOCSIZE(x) malloc_usable_size(x)
#else
#undef SQLITE_MALLOCSIZE
#endif
//-------------

Was it intentional or occasional?

Max
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to