Search code examples
xmldelphimsxml

MSXML Out Memory -Delphi


MSXML fails with out of memory when we try to transform XML about 160MB.

What is interesting about this is that it fails only for a certain server, I can transform the same file successfully without any issues on my computer.

Here are the things I tried:

  • Increase Virtual memory -had no effect
  • Already tried unloading the dll that helped for a while but once file size get huge again happens only on that server

I was trying to make my application large adress aware by setting PE flag but feel this might not work with delphi 5 .

Note: I know MSXML uses a DOM model and pulls everything into memory but we can't move from this model and have fix this.

Any suggestions would be appreciated. DELPHI 5 MSMXML 6


Solution

  • Large address aware is probably your only hope. You won't be able to do that with the built in Borland memory manager. So using FastMM or even a replacement based of the platform HeapAlloc would get you over that hurdle. There may be other problems with large address aware and the RTL/VCL but I would be confident. I did all of this successfully with Delphi 6 so Delphi 5 shouldn't be out of the question.

    Fundamentally you need to switch to a SAX parser. DOM based parsers don't mix with 32 bit address space and huge XML files.