Hi all,
I'm curious if anyone has experience a memory leak
with sqlite? Here is the program outline:
sqlite_open
create table
create unique index
begin transaction
loop 10000
SqlStmt "insert into x (a,b) values (? ? ) "
first time sqlite_compile
else sqlite_reset
sqlite_bind (pvm,1,a,aLen, 0)
sqlite_bind (pvm,2,b,bLen, 0)
sqlite_step
end loop
commit transaction
sqlite_finalize
sqlite_close
print sqlite_nMalloc
print sqlite_nFree
---- Output:
Number of Mallocs: 101882
Number of Free : 66747
--- Also I ran this through valgrind on linux and had
the following output...
===========================================
==3457== Syscall param write(buf) contains
uninitialised or unaddressable byte(s
)
==3457== at 0x40317108: __GI___libc_write (in
/lib/i686/libc.so.6)
==3457== by 0x806F86E: pager_write_pagelist
(pager.c:1262)
==3457== by 0x80709F2: sqlitepager_commit
(pager.c:2020)
==3457== by 0x805F6BB: fileBtreeCommit
(btree.c:911)
==3457== Address 0x412023D2 is 186 bytes inside a
block of size 1364 alloc'd
==3457== at 0x4002CD3C: malloc
(vg_replace_malloc.c:153)
==3457== by 0x804E0DF: sqliteMallocRaw (util.c:268)
==3457== by 0x806F98D: sqlitepager_get
(pager.c:1387)
==3457== by 0x805F59B: newDatabase (btree.c:840)
==3457==
==3457== ERROR SUMMARY: 19 errors from 1 contexts
(suppressed: 0 from 0)
==3457== malloc/free: in use at exit: 53791 bytes in
205 blocks.
==3457== malloc/free: 649 allocs, 444 frees, 267362
bytes allocated.
==3457== For counts of detected errors, rerun with: -v
==3457== searching for pointers to 205 not-freed
blocks.
==3457== checked 3904684 bytes.
==3457====3457== 640 bytes in 8 blocks are still
reachable in loss record 1 of 3
==3457== at 0x4002D2BE: realloc
(vg_replace_malloc.c:310)
==3457== by 0x804E14B: sqliteRealloc (util.c:297)
==3457== by 0x804FB05: expandCursorArraySize
(vdbe.c:415)
==3457== by 0x8053D89: sqliteVdbeExec (vdbe.c:2410)
==3457==
==3457==
==3457== 745 bytes in 75 blocks are still reachable in
loss record 2 of 3
==3457== at 0x4002CD3C: malloc
(vg_replace_malloc.c:153)
==3457== by 0x804E0DF: sqliteMallocRaw (util.c:268)
==3457== by 0x804AE44: findLockInfo (os.c:315)
==3457== by 0x804AFE9: sqliteOsOpenReadWrite
(os.c:476)
==3457==
==3457==
==3457== 52406 bytes in 122 blocks are still reachable
in loss record 3 of 3
==3457== at 0x4002CD3C: malloc
(vg_replace_malloc.c:153)
==3457== by 0x804E090: sqliteMalloc (util.c:254)
==3457== by 0x8049EC2: sqlite_open (main.c:476)
==3457== by 0x80491A7: main (ken_ins.c:113)
==3457==
==3457== LEAK SUMMARY:
==3457== definitely lost: 0 bytes in 0 blocks.
==3457== possibly lost: 0 bytes in 0 blocks.
==3457== still reachable: 53791 bytes in 205
blocks.
==3457== suppressed: 0 bytes in 0 blocks.
==3457==
So, I'm curious if this is "normal and expected
behavior" It seems that the program grows pretty
rapidly when using the compile/reset methods.. And
that the VM memory is being added to each time
through the loop.
Its starts at rough size of about 2m of Virtual Memory
and grows to 30M of VM through the execution of the
loop. Any ideas on how to reclaim this memory?
Thanks in advance.
Ken
__________________________________
Do you Yahoo!?
Take Yahoo! Mail with you! Get it on your mobile phone.
http://mobile.yahoo.com/maildemo
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]