The information in this article applies to:
SUMMARYWhen developing an application that loops through a DAO Jet Recordset, it is possible to control the amount of memory resources that Jet will use for cache. The property that can effect this control is dbMaxBufferSize, which is a Constant of the DBEngine.SetOption method. This article explains how this memory cache is calculated and how setting MaxBufferSize will limit that cache size. MORE INFORMATION
The Jet MaxBufferSize is a registry entry in the path Jet\3.5\Engines\Jet
3.5\. It normally is set to zero(0). The setting of zero indicates that Jet
will use a default algorithm to determine the maximum cache size. That
algorithm is "(((Total RAM on machine in MB - 12MB) / 4) + 512K)". This
will return a value equal to the number of pages that the cache size can
increase. Each page is 2048 bytes, so for a machine with at least 64MB of
RAM, this algorithm will return approximately 14 MB. This is the maximum
memory that Jet will consume from its startup point.
(64Mb - 12Mb) / 4 + 512K Jet will not allow the "Total RAM on machine" calculated above to exceed 64. If the total RAM on the machine is 12 MBytes or less, then the algorithm will create a 512KB cache buffer. Jet will use memory for its cache until it reaches this dynamic setting if the MaxBufferSize registry setting is zero (0). If the MaxBufferSize registry setting is set at 512, for example, the cache size will be limited to 512KB. Once Jet exceeds the setting, it will fire off a background thread to reduce the memory to the point that it goes below the maximum cache size setting. The Visual Basic code to accomplish this is:
This will set the maximum cache size to 512KB. Following is an example of a Visual Basic project that will illustrate a way to cause the Jet cache buffer size to increase until it hits the limit of the MaxBufferSize setting. You will need to create an Access MDB file named Test with a single table in it called Table1. Table1 will have a single field called F1 with a default datatype of Text. Follow these steps to create the Visual Basic Project:
Depending upon the amount of RAM, it may take a while before the Jet cache stops increasing with this test. On a 128MB, 300Mhz Pentium machine, it can take over 20 minutes before the cache memory allocation hits the limit when MaxBufferSize was at the default setting of zero (0). REFERENCESMicrosoft Jet Database Programmer's Guide, p605-606, Appendix C Additional query words: kbDSupport kbdse kbDAO kbDAO350 kbVBp500 kbVBp400 kbVBp
Keywords : kbGrpVBDB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |