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