PRAGMA page_size = 8192 may be cause leak

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

PRAGMA page_size = 8192 may be cause leak

Kent Carlson
When running this program with Apple's Instruments memory profiler leaks are reported when the tree is balanced, stack crawls are related to the page cache.

   1 sqlite3memtest sqlite3MemMalloc /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:21312

   2 sqlite3memtest mallocWithAlarm /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:24996

   3 sqlite3memtest sqlite3Malloc /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:25026

   4 sqlite3memtest pcache1Alloc /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:45870

   5 sqlite3memtest pcache1AllocPage /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:45966

   6 sqlite3memtest pcache1FetchStage2 /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:46436

   7 sqlite3memtest pcache1FetchNoMutex /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:46540

   8 sqlite3memtest pcache1Fetch /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:46582

   9 sqlite3memtest sqlite3PcacheFetch /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:45045

  10 sqlite3memtest getPageNormal /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:52859

  11 sqlite3memtest sqlite3PagerGet /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:53043

  12 sqlite3memtest btreeGetPage /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:61558

  13 sqlite3memtest btreeGetUnusedPage /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:61687

  14 sqlite3memtest allocateBtreePage /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:65510

  15 sqlite3memtest balance_quick /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:66464

  16 sqlite3memtest balance /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:67554

  17 sqlite3memtest sqlite3BtreeInsert /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:67811

  18 sqlite3memtest sqlite3VdbeExec /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:83397

  19 sqlite3memtest sqlite3Step /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:77352

  20 sqlite3memtest sqlite3_step /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:77416

  21 sqlite3memtest sqlite3_exec /KentDev/sqlite3memtest/sqlite3memtest/sqlite3.c:111930

  22 sqlite3memtest main /KentDev/sqlite3memtest/sqlite3memtest/main.c:99

If I change the page_size pragma to 4096 (or leave it at the default) no leaks are reported by Instruments.

A page_size of 16384 will also report leaks.

I tried running valgrind on the app and but it doesn't report leaks.  I think I see a similar leak if I interrupt the program.  (valgrind reports them as a possible leak in this case)  This is starting to make me think it may be a false positive but just thought I would check to make sure it isn't a leak.

I've included the project which has the 3.20.1 amalgamation included within it.

Thanks,
Kent Carlson

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

main.c (4K) Download Attachment