PRB: NOT_ENOUGH_STORAGE Errors in IIS Log File

ID: Q193026


The information in this article applies to:


SYMPTOMS

When you open a rowset, the OLE DB Provider for ODBC tries to reserve a block of memory that can be 64K times greater than the size of a single row. Under some circumstances, the reservation can be far larger (7MG+) but for the purpose of discussion in this article, assume 64K is the average. If the OLE DB Provider cannot reserve this block of memory, the OLE DB Consumer application will receive E_OUTOFMEMORY error.

This error message can occur even when there is plenty of memory left on the system, and, depending on the environment, the error message might not be E_OUTOFMEMORY. Internet Server sites that use ADO (ActiveX Data Objects) heavily with the OLE DB Provider for ODBC might receive the following error message in the IIS Log file:

Not_enough_storage_is_available_to_complete_this_operation


CAUSE

The E_OUTOFMEMORY error message is caused by the failure of the virtual allocation to reserve a block of memory 64K times the size of a single row in the rowset (ADO Recordset) that is being opened by the provider. The address space reservation fails due to memory fragmentation in the applications process address space, not due to an actual shortage of memory.

NOTE: Memory managers normally include algorithms that address memory fragmentation. However, since Microsoft Data Access Components (MDAC) uses virtual memory directly (for performance gains) it bypasses the algorithms in the heap memory manager, thus allowing fragmentation to occur.

For example, for Internet Information Server applications this would be the Internet Service Process (InetInfo.exe). Memory fragmentation occurs in the Inetinfo.exe process address space when MDAC reserves and then releases memory blocks on each page. If the row size is 200 bytes, then MDAC will reserve a memory block 12.8 Meg in size. When combined with smaller memory allocations that fill the large memory "holes" vacated by the multiple-megabyte allocations. Further, smaller allocations on the same page as the large allocation mean the page will not be released until all allocations, large and small, have been released.

A diagram of how the memory fragmentation occurs follows:

  1. .........................................


  2. 7777777.................................. Large block reserved.


  3. 77777771................................. Small block allocated.


  4. .......1................................. Large block released.


  5. 1......1................................. Small block allocated.


  6. 1......17777777.......................... Large block reserved.


  7. 1......177777771......................... Small block allocated.


  8. 1......1.......1......................... Large block released.


  9. 1......1.......1......................... Small block allocated.


After numerous iterations of small and large allocations, the example process address space becomes so fragmented that the large allocation no longer fits in memory, resulting in the E_OUTOFMEMORY error.


RESOLUTION

A supported fix that corrects this problem is now available from Microsoft with Windows NT 4.0 Service Pack 4 for MDAC 2.0. MDAC 2.0 Service Pack 1 only ships in the context of Windows NT 4.0 Service Pack 4 (and should not be used on Windows 95 or Windows 98 or Windows NT 4.0 Service Pack 3). For users who are not installing Windows NT 4.0 Service Pack 4, a hotfix is available for both MDAC 1.5 and 2.0.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information on support costs, please go to the following Web site:

http://support.microsoft.com/support/supportnet/default.asp
The English version of the MDAC 1.5c fix should have the following file attributes or later:


   Version         Size     Date       File name      Platform
   -----------------------------------------------------------

   1.50.4515.0        113   09-08-98   Maxblock.reg  (x86)
   1.50.4515.0     47,600   09-15-98   Msdadc.dll
   1.50.4515.0     16,752   09-15-98   Msdaenum.dll
   1.50.4515.0     29,920   09-15-98   Msdaer.dll
   1.50.4515.0     13,072   09-15-98   Msdaerr.dll
   1.50.4515.0     14,336   09-15-98   Msdaps.dll
   1.50.4515.0    263,056   09-15-98   Msdasql.dll
   1.50.4515.0     17,408   09-15-98   Msdasqlr.dll
   1.50.4515.0     60,048   09-15-98   Msdatl.dll
   1.50.4515.0     39,120   09-15-98   Msdatt.dll 


The English version of the MDAC 2.0 fix should have the following file attributes or later:

   Version        Size      Date       File name      Platform
   -----------------------------------------------------------

   2.0.3002.23        113   09-08-98   Maxblock.reg   (x86)
   2.0.3002.23    287,184   09-10-98   Msdasql.dll
   2.0.3002.23      9,728   09-10-98   Msdasqlr.dll
   2.0.3002.23     67,152   09-10-98   Msdatl2.dll
   4.0.1381.0      30,720   03-13-98   Regsvr32.exe 


Installation Instructions

  1. For MDAC 1.5c, extract the MDAC 1.5c files from Oledb15c.exe to C:\Mdacfix.

    For MDAC 2.0, obtain MDAC 2.0 Service Pack 1 (preferred) and run MDAC_TYP.exe to install the service pack.


  2. Stop the IIS Admin service and any other applications that use MDAC.


  3. Copy over the existing OLE DB files. For example:

    xcopy c:\mdacfix "C:\Program Files\Common Files\System\OLE DB"


  4. For MDAC 1.5c, double-click C:\MDACFix\MAXBlock.reg to enter the necessary registry changes.

    For MDAC 2.0, double-click C:\MDACFix\MAXBlock.reg to enter the necessary registry changes.


  5. Shut down and restart.


NOTE: If you contact Microsoft to obtain this fix, you may be charged a fee. This fee is refundable if it is determined that you only require the fix you requested. However, this fee is non-refundable if you request additional technical support, if your no-charge technical support period has expired, or if you are not eligible for standard no-charge technical support.

For more information about eligibility for no-charge technical support, see the following article in the Microsoft Knowledge Base:
Q154871 Determining If Your Product Is Eligible for No-Charge Technical Support


STATUS

Microsoft has confirmed this to be a problem in Data Access Components versions 1.5c and 2.0. This problem has been fixed in MDAC 2.02, which ships with Windows NT 4.0 Service Pack 4.


MORE INFORMATION

The fix resolves the address space problem by reducing the default virtual address allocations to 16 KB. Large queries still complete because the updated MDAC components reallocate virtual address space if you need more than 16 KB.

NOTE: You can further tune the default allocation size of 16 KB by adjusting the new registry value:


   HKEY_CLASSES_ROOT\CLSID\{c8b522cb-5cf3-11ce-ade5-
   00aa0044773d}\Flags\"MaxBlock" 
You can reduce the default allocation further to 100, but no lower than this value.

Additional query words:


Keywords          : kbMDAC200bug kbMDAC200fix kbMDAC150bug 
Version           : WINDOWS:1.5,2.0; winnt:4.0
Platform          : WINDOWS winnt 
Issue type        : kbbug 

Last Reviewed: July 2, 1999