# Export to ExpressionML extreme memory consumption

I have a big variable, data, that is (roughly) a large list of polynomials in x with numerical coefficients at high precision (say with SetPrecision[coeff,200]). If I dump this variable with

DumpSave["fname.mx",data]

I obtain a file which has a size of about 24MB. I need data to be exported into an XML with

Export["fname.xml",data, "ExpressionML"]

to have the right format so it can be used by an external program. The problem is that to export data to XML, Mathematica is using more than 4GB (!) of RAM. I find that very excessive, as I would expect the RAM used to be of the order of the .mx file, not order thousands more.

As the machine we are using does not have an excessive amount of memory, this has forced us to first dump data to an mx file at the end of our script so we can free up the memory, and then reopen a new script whose sole puprose is to load the mx and export it to xml.

The only "non-standard" format of data is that to be used by the external program we have to name the elements of the list in a praticular way, namely:

data= { Matrix[Prefactor[a,b,c], {pol1, pol2,...}, ...}

where a,b,c are numbers, and pol1, ... polynomials in x, such that the resulting XML has the correct tags for the external program.

Is this huge RAM consumption expected, and if so, is there any way to reduce it?

• Could you post a minimal working example reproducing the issue? – Alexey Popkov Nov 8 '19 at 12:05