[sqlite] msize in 3.7.10

20 views
Skip to first unread message

Max Vlasov

unread,
Jan 17, 2012, 9:11:12 AM1/17/12
to General Discussion of SQLite Database
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)?

Thanks,

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

Max Vlasov

unread,
Jan 18, 2012, 6:56:41 AM1/18/12
to General Discussion of SQLite Database
On Tue, Jan 17, 2012 at 6:11 PM, Max Vlasov <max.v...@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?

Richard Hipp

unread,
Jan 18, 2012, 7:47:43 AM1/18/12
to General Discussion of SQLite Database
On Tue, Jan 17, 2012 at 9:11 AM, Max Vlasov <max.v...@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)?
>

Try using the trunk of the SQLite source tree with the SQLITE_WITHOUT_MSIZE
preprocessor macro.


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

--
D. Richard Hipp
d...@sqlite.org

Max Vlasov

unread,
Jan 18, 2012, 7:56:51 AM1/18/12
to General Discussion of SQLite Database
On Wed, Jan 18, 2012 at 4:47 PM, Richard Hipp <d...@sqlite.org> wrote:

> Try using the trunk of the SQLite source tree with the SQLITE_WITHOUT_MSIZE
> preprocessor macro.
>
>
>

Richard, thank, I will try, but I just tried to replace

#if !defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN


# define HAVE_MALLOC_USABLE_SIZE 1
# define malloc_usable_size _msize
#endif

.....with

#if defined(HAVE_MALLOC_USABLE_SIZE) && SQLITE_OS_WIN


# define malloc_usable_size _msize
#endif

isn't it a proper fix for HAVE_MALLOC_USABLE_SIZE to work on windows? I
compiled, it doesn't require __msize anymore and work.

Max Vlasov

unread,
Jan 18, 2012, 8:18:40 AM1/18/12
to General Discussion of SQLite Database
On Wed, Jan 18, 2012 at 4:47 PM, Richard Hipp <d...@sqlite.org> wrote:

> On Tue, Jan 17, 2012 at 9:11 AM, Max Vlasov <max.v...@gmail.com> wrote:
>
> > Hi,
> > I'm using static linking with Delphi and a new function required binding
> in
> > 3.7.10 - msize (__msize).

> > ...


>
> Try using the trunk of the SQLite source tree with the SQLITE_WITHOUT_MSIZE
> preprocessor macro.
>
>
>

Richard, thanks, tried trunk, everything works, also saw the comment in the
sources about automatic usage of msize on Windows. So probably having
HAVE_MALLOC_USABLE_SIZE always defined on Windows is necessity.

Reply all
Reply to author
Forward
0 new messages