Hi all,

 

I wrote a simple C++ program that spawns 10 threads, each thread

-          creates an SQLite handle (threads don't share connections)

-          opens a database (common to all the threads), or creates it
(with "Write-Ahead Log" option) if open fails

-          creates a table on the database

-          goes into an infinite loop in which:

o   opens a connection with the SQLITE_OPEN_NOMUTEX flag set

o   sets timeout to 1 minute

o   does a BEGIN TRANSACTION

o   writes 20000 rows

o   commits the transaction

o   closes the connection

 

I found out that the program 'leaks' about 2 handles every 5 minutes. A
colleague and I found that the SQLite method 'winShmMap' is storing the
handles in the array pShmNode->aRegion (line 35488).

This array should be cleared in 'winShmPurge' but in our code that
number of connection references (line 35233) is never 0, se we never
call it. Is there a way to release handles even if a connection is still
opened? Maybe a PRAGMA that needs to be set or a function call?

 

You can find the Visual Studio 2010 project used for testing in the
following link:

https://docs.google.com/open?id=0B1Z2DQ4ECc2OWFRvbVpGYnpDamM

 

Thank you very much for your help.

 

Best Regards,

Andrea Guardascione


_____________________________________________________________________ 

This email is intended only for the use of the individual or entity named above 
and may contain information that is confidential and/or privileged. If you are 
not the intended recipient, you are hereby notified that any dissemination, 
distribution or copying of this Email is strictly prohibited. If you have 
received this Email in error, please notify us immediately by return email or 
telephone +61 2 9966 1066 and destroy the original message. Thank You
_______________________________________________________________________
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to