ak1mbox-jxta-FFYn/[EMAIL PROTECTED] wrote:
I am using sqlite3 under Windows XP as a part of my
application, sqlite is compiled as a dll.

I am noticing big memory usage fluctuations coming
from my application which I believe may originate from
sqlite. I am seeing the following behaviour, on
machines with small amount of free memory the
application seems to always deallocate memory
frequently and never takes up a lot. On the machines
with memory to spare the application never seems to
deallocate and the memory usage continues to grow.

That's the way Windows manages memory. It has nothing to do directly with SQLite.

The way it works, after a process "touches" a memory page, this page belongs to this process' working set. If there is no memory pressure on the system, the page will just sit in the working set, even if it is unused. If some other process needs memory, and there are no "unassigned" pages, the system will take unused pages out of other processes' working sets. If there are none, it will take used pages, on a least-recently-used basis, save their contents to swap file and hand them over.

SQLite may make this behavior more obvious because it tends to request (and then free) large amounts of memory in short bursts, when processing large transactions. But even though the memory is released by SQLite, it remains in the process' working set.

Mem Usage column in the Task Manager shows the working set size and doesn't really reflect the amount of memory used by the process. A more relevant measure is Private Bytes counter in PerfMon.

See also SetProcessWorkingSetSize[Ex]

Igor Tandetnik

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to