Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Memory use by MSXML

From: DarrenMorby@-----------.---------.---
To: NULL
Date: 9/2/2008 11:40:00 AM

Hi, I'm using MSXML4 and I'm having an issue with memory allocation which 
appears to be a memory leak, but isn't exactly. Let me explain.

I have this one XML file (the "IXM" file) that contains the names of 148 
other XML files (the "external" files). What is supposed to happen is that 
the app reads the IXM file, then reads each external file named in the IXM 
file, then copies the external file's data to the database.  The problem is 
that after about 36 external files, it runs out of memory. Each external file 
is generally between 104 MB and 106 MB, but some are larger. The largest is 
136 MB.  The external files are in ASCII.

I run performance monitor and monitor virtual bytes.  It seems that the 
virtual bytes are increasing all the time, and by the time of the 36th 
external file, virtual bytes tries to exceed 2 GB, and it bombs.

Based on experiments I've done, I conclude the following:

1. When MSXML is allocating memory, it is not doing so on the process heap, 
but on its own heap, so memory looks like this:

[PROCESS-HEAP][HEAP-1][HEAP-2][MSXML-HEAP-1][MSXML-HEAP-2]

2. The SAX parser in MSXML reads the entire external file into a contiguous 
region of memory before it will call the content handler.

3. If MSXML cannot load the entire external file into a contiguous region of 
memory in its own heaps, it allocates another heap:

[PROCESS-HEAP][HEAP-1][HEAP-2][MSXML-HEAP-1][MSXML-HEAP-2][MSXML-HEAP-3]

[PROCESS-HEAP][HEAP-1][HEAP-2][MSXML-HEAP-1][MSXML-HEAP-2][MSXML-HEAP-3][MSXML-HEAP-4]

[PROCESS-HEAP][HEAP-1][HEAP-2][MSXML-HEAP-1][MSXML-HEAP-2][MSXML-HEAP-3][MSXML-HEAP-4][MSXML-HEAP-5]

It does not seem to be freeing the extra heaps that it is creating.  So 
eventually, it will try to allocate a memory block that's too big for the 
existing heaps and too big to allocate a new heap.

Assuming that's the case:

1. How do I free up all the heaps that MSXML allocates, preferably between 
external files?

2. How do I get MSXML to use the app's heap instead of creating its own?

3. Is there any other strategy that I could try?

-- Thanks
-- Darren --


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent