Microsoft KB Archive/116135

{|
 * width="100%"|

FIX: OnIdle Processing Can Hang in Low-Memory Situations

 * }

Q116135

1.00 WINDOWS kbprg kbfixlist kbbuglist - The information in this article applies to: - The Microsoft Foundation Classes (MFC) included with: Microsoft Visual C++ for Windows, version 1.0 - SYMPTOMS ======== An application that uses the Microsoft Foundation Class (MFC) library might hang in situations where memory is extremely low. CAUSE ===== The MFC library does idle-time processing to attempt to reclaim available memory for its safety memory pool. This processing is done in CWinApp::OnIdle at approximately line 540 in the module APPCORE.CPP. OnIdle uses a while loop to attempt to reclaim this memory. However, if the available memory is sufficiently low, the entire pool cannot be reclaimed and the while loop never exits, hanging the application. RESOLUTION ========== To avoid the potential problem, do one of the following: - Upgrade to Visual C++ for Windows, version 1.5, because the problem has been fixed in the MFC Library, version 2.5. -or- - Modify the code in the APPCORE.CPP module to use an if statement instead of a while statement, and rebuild the MFC library. For example, the code at line 540 in the APPCORE.CPP module should be changed from: while ((m_pSafetyPoolBuffer == NULL || _msize(m_pSafetyPoolBuffer) < m_nSafetyPoolSize) && m_nSafetyPoolSize != 0) to the following: if ((m_pSafetyPoolBuffer == NULL || _msize(m_pSafetyPoolBuffer) < m_nSafetyPoolSize) && m_nSafetyPoolSize != 0) STATUS ====== Microsoft has confirmed this to be a problem in Visual C++ for Windows, version 1.0. This problem was corrected in Visual C++ 1.5. This is not a problem in Visual C++ 32-bit Edition. MORE INFORMATION ================ For more information regarding building the MFC library, refer to Appendix B in the "MFC User's Guide," provided with Visual C++ for Windows, version 1.0. Additional reference words: runtime infinite loop 1.00 2.00 KBCategory: kbprg kbfixlist kbbuglist KBSubcategory: MfcMisc

Keywords : kb16bitonly kbnokeyword kbMFC kbVC

Issue type :

Technology : kbAudDeveloper kbMFC