Hi all. I didn't receive a response for a week - I'm guessing I was just lost in the shuffle... - Phil
-----Original Message----- From: Schlesinger, Philip Sent: Tuesday, July 25, 2006 3:08 PM To: xalan-c-users@xml.apache.org Subject: RE: NT Xalan memory leak detected in debug version of sample program TransformToXercesDOM; release does not report leak Dear David, Sorry for not getting back earlier on this one. As we had built Xerces and Xalan with ICU, I added the XalanTransformer::ICUCleanUp() immediately after XMLPlatformUtils::Terminate(); (you said in your email below to add it after "PlatformUtils::Terminate()" - "XMLPlatformUtils::Terminate()" was the closest thing I could find to it in the TransformToXercesDOM.cpp file) I then added some printf() statements to XalanTransformer::ICUCleanUp() and XalanTransformer::terminate() at the end of the "#if defined(XALAN_USE_ICU)" segments (i.e. after "ICUBridgeCleanup::cleanup();" had been called). Both of my printf statements showed up when I ran the TransformToXercesDOM test, and then immediately appended after the printf statements was the same "Detected memory leaks! Dumping objects -> ..." message. Ideas? - Phil -----Original Message----- From: David Bertoni [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 12, 2006 5:58 PM To: xalan-c-users@xml.apache.org Subject: Re: NT Xalan memory leak detected in debug version of sample program TransformToXercesDOM; release does not report leak Schlesinger, Philip wrote: > Dear all, > > When building Xalan on NT, the debug version of the sample program > TransformToXercesDOM reports memory leak when the following command is > executed. The Release version does not report a memory leak. > The release version of the executables never reports memory leaks, since these are reported using a feature of Microsoft's debug C run-time library. This should be obvious from a quick glance at the code: int main( int argc, char* argv[]) { #if !defined(NDEBUG) && defined(_MSC_VER) _CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF); _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); #endif > Detected memory leaks! > Dumping objects -> > {308} normal block at 0x00A77FA0, 24468 bytes long. > Data: < > 01 00 00 80 00 00 00 00 00 00 00 00 01 00 00 > 80 > {307} normal block at 0x00A77F38, 48 bytes long. > Data: < > A0 7F A7 00 01 00 00 00 F7 07 00 00 07 00 00 > 00 > {306} normal block at 0x00A77EB0, 88 bytes long. > Data: <X h~ > 58 00 00 00 00 00 00 00 68 7E A7 00 00 00 00 > 00 > {305} normal block at 0x00A77E68, 28 bytes long. > Data: < 7 K > 00 00 00 00 E0 37 1A 4B 00 00 00 00 01 00 00 > 00 > Object dump complete. > These are probably from the ICU, if you built Xerces-C or Xalan-C with ICU integration. You can verify this by adding a call to XalanTransformer::ICUCleanUp() after the call to PlatformUtils::Terminate(). If you built Xalan-C with ICU integration, and the "leaks" are from the ICU, they should disappear. If you didn't build Xalan-C with ICU integration, then the call is a no-op. If that's the case, you'll need to make the ICU call directly. You can do this by including the header file unicode/uclean.h, and calling the function u_cleanup(). Xalan-C is tested regularly for memory leaks, so they're extremely rare. Dave