> What you are observing is the Windows System File Cache.
I already explained this is not the normal Windows File Caching that you would
typically see. File Caching would be under STANDBY Mapped File and can be
easily removed from RAM when memory is needed for something else. You can even
confirm this yourself very easily, but just running RamMap. Or you can even
confirm Disk Cache is named "Standby" by just launching Resource Monitor.
Since it's marked as Active, it consumes RAM as if it was a running process.
Hence the name, active.
From the various screenshots I included you can even confirm it's not normal
disk cache. Even see after I close the process in Task Manager, the extra RAM
is immediately freed up and increases the "Cached' and "Available" rows by
several GBs. If it's not clear, "Cached" is Disk Cache.
On Thursday, May 25, 2017 8:02 PM, Keith Medcalf <[email protected]>
wrote:
On Wednesday, 24 May, 2017 18:48, Jamie <[email protected]> wrote:
> When I'm performing a large amount of selects of GLOBs/thumbnails from an
> ongoing SQLiteConnection, I'm having a problem where the Windows Active
> Mapped File will constantly grow out of control in size (memory leak?).
> This is under Windows 7, using a .Net Framework 4.0 C# application with
> System.Data.SQLite 1.0.105.1. This is not the optional disk cache that can
> be removed from RAM, but rather a Windows Mapped File marked as 'active'
> that will eat up precious RAM, and I've seen as high as 4GB when I let it
> go on.
What you are observing is the Windows System File Cache.
Memory that is "free" (as in not being used for anything at all) is memory that
you simply should not have bought. A properly tuned computer system should
consume exactly 100% of all available resources at all times with no
over-commitment (that is, no bottlenecks appearing). On bitty-boxen this is
usually very hard to achieve because they are designed for limited utility and
performance.
What is the "issue" you are seeing?
If it is "only" that what would otherwise be wasted resources being used for
something that may be useful (this is Windows after all, so utility by design
is bound to be sum-optimal) then there is really no issue.
If you are encountering performance issues due to excessive system cache
forcing out more useful purposes (such as process working set), and you have
already set Windows into "Rational Behaviour" mode (prefer Application over
Cache, as opposed to the highly irrational windows default to prefer useless
crap over usefulness -- just like the default used to be to optimize for
maximum CPU usage -- at least now Windows just sits around consuming no
resources and doing nothing asking you to please wait for it to get on with
doing something useful) then you are running into a known Microsoft Bug that
has existed in all versions of Windows since, well, forever.
https://support.microsoft.com/en-us/help/976618/you-experience-performance-issues-in-applications-and-services-when-the-system-file-cache-consumes-most-of-the-physical-ram
If you are merely upset that the RAM you paid good money for is actually being
used for something, then simply stop worrying. As I said, unused RAM is a
waste of money. You can reduce the amount of RAM used by physically unplugging
some from the computer. As I said though, in "normal" operation all resources
(including RAM) should be 100% in use.
> Active Mapped Files cannot be seen under Windows Task Manager, and won't
> count against the memory usage for a process, rather one will need a
> Microsoft utility called RamMap to see the problem:
> https://technet.microsoft.com/en-us/sysinternals/rammap.aspx
Of course not. The memory does not belong to and is not associated with the
process. It belongs to the system.
> Here is a small test application I created to help isolate the issue. All
> the application does is read BLOBs/thumbnails from a table in an infinte
> loop and throws them away. The application itself uses very little RAM.
> http://i.imgur.com/mod5ISX.png
>
> Here's an example of The Active Mapped File growing to insane sizes while
> my test application is running and the connection is still open. The
> active column is the one of concern:
> http://i.imgur.com/lVV97m7.png
>
> Here are another two images of the change in RAM usage in Task Manager,
> before and after closing the process, even though the process itself shows
> very small RAM usage under all memory columns:
> http://i.imgur.com/LRzzUFc.png
> http://i.imgur.com/k5zNkLj.png
>
> If anyone knows how I can prevent the Active Mapped File from continuously
> growing larger, please let me know. I've tried changing the Connection
> String, calling different methods on the SQLiteConnection (reset and
> clear), and ensured I was disposing everything appropriately, but I
> haven't managed to find how to reduce the the Active Mapped File size
> while the connection remains.
>
> Thank you for any help on the matter, and sorry for the long explanation.
Like I said, you can remove RAM from the computer. If you currently have 8 GB
and you remove 4 GB, then only 4 GB of RAM will be used. Other than that there
is no point whatsoever in doing anything at all unless you have run into the
known Windows Bug where the system cache forces useful stuff out of memory and
causes working set thrashing.
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users