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)?
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 //-------------
On Tue, Jan 17, 2012 at 9:11 AM, 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)?
Try using the trunk of the SQLite source tree with the SQLITE_WITHOUT_MSIZE preprocessor macro.
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
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.vla...@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.