A. The maximum size is 102MB, however it is slightly more complicated than this.
The registry entry that controls the maximum size of the registry is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\RegistrySizeLimit. By default this entry will not exist so it will need to be created:
- Start the registry editor (regedit.exe)
- Move to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control key
- From the Edit menu, select New - DWord value and enter the name as RegistrySizeLimit
- Double click the new entry and enter a value in bytes (choose decimal as the type)
The minimum size is 4MB, and if anything less than this is entered in the registry then it will be forced up to 4MB. The maximum is 80% of the paged pool (which has a maximum size of 128MB, hence 102MB which is 80% of 128MB). If no entry is entered then the maximum size is 25% of the paged pool. The paged pool is an area of physical memory used for system data that can be written to disk when not in use.
An important point to note is that the RegistrySizeLimit is a maximum, not an allocation, and so setting a high value will not reserve the space, and it does not guarantee the space will be available.
This can also be configured using the System Control Panel applet, click on the Performance tab and the maximum registry size can be set there. You would then need to reboot.
For more information see Knowledge Base Article Q124594
There is another complication, during early boot, NTLDR loads some code, allocates working memory, and reads in parts of the registry. All of this has to fit in the first 16MB of memory regardless of how much memory is physically installed. The entire system file is read; enough memory is required to contain the whole file as stored on disk without regard to how much of it is useful.
- The registry contains wasted space (sometimes a LOT). Try saving the SYSTEM key from REGEDT32 and then comparing the saved file size with that of the SYSTEM hive in \%systemroot%\system32\config\. On one machine, I reduced the SYSTEM hive from 9,720 KB to 864 KB in this manner.
- Creation of the LastKnownGood ControlSet (usually #2) soon after boot almost doubles the size of the file. Depending on circumstances, such as reclaimable space in the "gas", additions to the registry may require new space to be allocated beyond the end of the combined Current and LastKnownGood SYSTEM hive. Now after the next boot, another LastKnownGood is tacked onto the end of the file, adding about a third to its size. In my case, a registry with a "true" size of 4MB was thus inflated to 12MB and caused boot failure.
A number of ways to get rid of the excess space:
- If FAT, merely boot from DOS floppy, then replace the SYSTEM file
- If NTFS, boot from another NT partition and replace file in previous partition
- Use REGBACK/REGREST from the NT reskit. \[maybe easiest of all\]
- Run RDISK, shutdown, and repair the system. Make sure you use RDISK /s when using this to also backup the user database.
- Use ERD Commander from Winternals Software
To turn this off use REGEDT32 to add the value "ReportBootOk:REG_SZ:0" \[zero\] to HKEY_Local_Machine\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon This will prevent creation of the LastKnownGood ControlSet. If a boot fails because the 16 MB limit with NTLDR is exceeded, no dump can be produced and MS will not solve the problem. This 16 MB problem will not be changed in NT 5.