InterviewSolution
| 1. |
I Am Seeing Memory Leaks In Xerces-c++. Are They Real? |
|
Answer» The Xerces-C++ library allocates and caches some commonly reused items. The storage for these may be reported as memory leaks by some heap analysis tools; to avoid the problem, call the FUNCTION XMLPlatformUtils::Terminate() before your application exits. This will free all memory that was being HELD by the library. For most applications, the use of Terminate() is optional. The system will recover all memory when the application process shuts down. The exception to this is the use of Xerces-C++ from DLLS that will be repeatedly loaded and unloaded from WITHIN the same process. To avoid memory leaks with this kind of use, Terminate() must be called before unloading the Xerces-C++ library To ensure all the memory held by the parser are freed, the NUMBER of XMLPlatformUtils::Terminate() calls should match the number of XMLPlatformUtils::Initialize() calls. If you have built Xerces-C++ with dependency on ICU then you may want to call the u_cleanup() ICU function to clean up ICU static data. Refer to the ICU documentation for details. The Xerces-C++ library allocates and caches some commonly reused items. The storage for these may be reported as memory leaks by some heap analysis tools; to avoid the problem, call the function XMLPlatformUtils::Terminate() before your application exits. This will free all memory that was being held by the library. For most applications, the use of Terminate() is optional. The system will recover all memory when the application process shuts down. The exception to this is the use of Xerces-C++ from DLLs that will be repeatedly loaded and unloaded from within the same process. To avoid memory leaks with this kind of use, Terminate() must be called before unloading the Xerces-C++ library To ensure all the memory held by the parser are freed, the number of XMLPlatformUtils::Terminate() calls should match the number of XMLPlatformUtils::Initialize() calls. If you have built Xerces-C++ with dependency on ICU then you may want to call the u_cleanup() ICU function to clean up ICU static data. Refer to the ICU documentation for details. |
|