On 4/13/18, king3306 <1809860...@qq.com> wrote:
> HI
>
> I use sqlite3 in embedded arm
>
> my memory is very small  about 4M
>
> so i want to use MEMSYS5  to limit memory use
>
> i define DSQLITE_ENABLE_MEMSYS5   1  in sqlite3.c
>
> compile it
>
> in my code start  i use
>
>               
> sqlite3_config(SQLITE_CONFIG_HEAP,malloc(2*1024*1024),2*1024*1024);

sqlite3_config() is a varargs function.  SQLITE_CONFIG_HELP wants
three additional arguments, but you only gave it two.  It might better
if you gave it the third argument.  I suggest a value of 64.

Also, make sure sqlite3_config() returns SQLITE_OK.

>               sqlite3_config(SQLITE_CONFIG_PAGECACHE,malloc(4*1024),4*1024);

Again, you omitted the final argument.  And even then, it seems kind
of silly to configure a page cache that only holds one page.

Start by omitting the SQLITE_CONFIG_PAGECACHE call.  That will cause
SQLite to you the 2MiB of HEAP that you configured for the cache it
needs.

>
> before open database
>
> my purpose  is to limit memory usage < 2M + 4K
>
> but  i found sqlite3_memory_used=29126656
>
> is use 27M??  i can"t understand why
>
> what sqlite3_memory_used mean ?
>
>
>
>
>
> --
> Sent from: http://sqlite.1065341.n5.nabble.com/
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to