• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FSXA XtoMDL OOM error

Messages
218
Country
greece
XtoMDL OOM error (SOLVED!)

Guys, I'm trying to export the latest version of my F-4 VC, but I'm getting an out of memory error. I've located the problem to be the circuit breakers in the rear cockpit. Around 50-60% of them will export. It won't go any higher, though.
Truth be told, I made them too detailed for their size, so I supposed the problem could be due to vertex buffer limits.

But: When I first exported them, they all shared the same material (as well as a bunch of levers and switches), they were all independent objects and exported perfectly 2-3 times.

The problem came after I made a swap of 3-4 materials from Standard to FSX. Additionally, not even the pre-swap model compiles now. Anyone with an idea?

I'm using P3D v1.4 SDK with the x64 tools.
CPU and RAM are 4 cores @3.6GHz (with HyperThreading active), 16GB RAM @2133

Here is the error:
Code:
(0): error : XToMdl.exe Unhandled Application Exception
(0): error : System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

(0): error :    at System.IO.MemoryStream.set_Capacity(Int32 value)

(0): error :    at System.IO.MemoryStream.EnsureCapacity(Int32 value)

(0): error :    at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)

(0): error :    at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)

(0): error :    at System.IO.StreamWriter.Flush()

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.EndElement(Boolean bIndent)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.StartElement(String szElement, String[] Attributes, String[] AttributeValues, String ElementContents)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.PartMesh.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.LODBucket.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.LODBuckets.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.WriteShadowModelEntry(String szDecoration, ModelProcessingContext Context)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.Export(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.OutputModels(IEnumerable ProcessedModels)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.OutputModels(IEnumerable`1 processedModels)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.Process(ModelFile[] InputFiles, Hashtable[] AnimationLinkage, String[] AnimationFileRef, XPartDict PartDictionary)

(0): error :    at Microsoft.FlightSimulator.XToMDL.XToMDL.ProcessInputs()

(0): error :    at Microsoft.FlightSimulator.XToMDL.XToMDL.RealMain(String[] args)

(0): error :    at Microsoft.FlightSimulator.XToMDL.XToMDL.Main(String[] args)
(0): error : 
(0): error : Exception of type 'System.OutOfMemoryException' was thrown.
(0): error : 
(0): error : Stack Trace:
(0): error :    at System.IO.MemoryStream.set_Capacity(Int32 value)

(0): error :    at System.IO.MemoryStream.EnsureCapacity(Int32 value)

(0): error :    at System.IO.MemoryStream.Write(Byte[] buffer, Int32 offset, Int32 count)

(0): error :    at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder)

(0): error :    at System.IO.StreamWriter.Flush()

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.EndElement(Boolean bIndent)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.StartElement(String szElement, String[] Attributes, String[] AttributeValues, String ElementContents)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.PartMesh.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.LODBucket.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.LODBuckets.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.ExportIndexList(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.WriteShadowModelEntry(String szDecoration, ModelProcessingContext Context)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.Export(FileExporter Exporter)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.FileExporter.OutputModels(IEnumerable ProcessedModels)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.OutputModels(IEnumerable`1 processedModels)

(0): error :    at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.Process(ModelFile[] InputFiles, Hashtable[] AnimationLinkage, String[] AnimationFileRef, XPartDict PartDictionary)

(0): error :    at Microsoft.FlightSimulator.XToMDL.XToMDL.ProcessInputs()

(0): error :    at Microsoft.FlightSimulator.XToMDL.XToMDL.RealMain(String[] args)

(0): error :    at Microsoft.FlightSimulator.XToMDL.XToMDL.Main(String[] args)
 
Last edited:
Problem seems solved. XtoMDL didn't like my having 3dsmax, 5 textures on Photoshop, Firefox and my music player on. For some reason it devours memory from that point on.
 
Alexis, I've run into that problem more than once with a large Max2012 project loaded. Even if I close a few programs (such as Photoshop), until I reboot the system to 'clear the memory' I continue getting a compiler error whining about being "out of memory..."

I only have 8GB DDR3 RAM in this fairly new dev computer. Obviously I need to at least double this to 16GB... ;)

One of these days I'm going to load up Process Monitor and see just how much memory the exporter is sucking up! :rotfl:
 
Alexis, I've run into that problem more than once with a large Max2012 project loaded. Even if I close a few programs (such as Photoshop), until I reboot the system to 'clear the memory' I continue getting a compiler error whining about being "out of memory..."

I only have 8GB DDR3 RAM in this fairly new dev computer. Obviously I need to at least double this to 16GB... ;)

One of these days I'm going to load up Process Monitor and see just how much memory the exporter is sucking up! :rotfl:

Logging out of windows usually does the trick, but sometimes I had to shut down and restart.
I took a look at Photoshop and it used ~7GBs the last time I had this error. Couple that with 3GBs by 3dsmax and another 3GBs from Windows, firefox and the rest. The compiler had a bit less than the max it can use, 2.5-3GBs. A safe bet would be 24GB if you want them all on.

But yes, it is a pain!
 
To lower your system resources, you could create JPG copies of your textures and use those in your Material Library.

That will help tremendously.

Are you using the newest Prepar3D SDK to create your models with? You can use the P3D V2 exporter in Max, then use the 1.4 SDK XtoMDL exporter (after export from Max) to create the final MDL files.

The V2 exporter from Max directly is rebuilt and all legacy taken out. Many bugs and flaws and bottleneck architecture were found and removed from it, so that might help you out as well.
 
I am using .tga files in 3ds max for that reason. I didn't know that the V2 plugins can export FSX compatible stuff. The problem lies with XtoMDL for me, though.
 
I found the solution to that after taking a look at P3D SDK's 1.4 readme.
All you have to do is add /WRITETOFILE in your command prompt when using XtoMDL (i.e. XtoMDL /XANIM /WRITETOFILE e.t.c.).

This will store intermediate stuff in the HDD instead of RAM, thus never running out of memory. It reminds me of the .asm files you could use with MakeMDL for FS9.

This was a case of RTFM for me!
 
I found the solution to that after taking a look at P3D SDK's 1.4 readme.
All you have to do is add /WRITETOFILE in your command prompt when using XtoMDL (i.e. XtoMDL /XANIM /WRITETOFILE e.t.c.).

Alexis, where exactly do you find this ref to /writetofile? I don't seem to be able to locate it.
 
Here!

It is also interesting that you have no texture vertex limits anymore. While a single object in 3ds max cannot have more than 65535 texture vertices, you can have many models that share the material and sum up more than those. I.e. I have a bunch of models assigned to the same material and their texture vertex total is ~73.000. It exports fine, independently of the /WRITETOFILE command.
 
Last edited:
Thank you for sharing a terrific find. I guess I should quit assuming that I know the SDK well enough to get by, eh?

I've added those switches to my SendTo shortcuts for both P3Dv1 and P3Dv2 compilers.

EDIT: Um, nope. I've removed that switch from both shortcuts due to this caution note:
This flag should only be used if absolutely necessary due to the increased amount of
time needed to export.
I'll only use the switch if absolutely necessary...
 
Last edited:
Thank you for sharing a terrific find. I guess I should quit assuming that I know the SDK well enough to get by, eh?

I've added those switches to my SendTo shortcuts for both P3Dv1 and P3Dv2 compilers.

EDIT: Um, nope. I've removed that switch from both shortcuts due to this caution note:

I'll only use the switch if absolutely necessary...

I'm using it anyway, but yes, exporting takes quite a while longer as the RAM transfer speed is way higher than an HDD or SSD transfer speed. I'm using it for smaller models too, I get no issues and my RAM is free for PS and 3ds max. :D

Updated the link to the release notes. I accidentally put the topic's one.

And here it is again: P3D Tools release notes
 
Last edited:
When I compile .mdl files, I'm doing so across a LAN, because I export the .x and .xanim files directly to my aircraft's ..\model folder. Otherwise I'd wind up having to copy/paste the compiled .mdl file(s) across the network anyway...

Because of this, the compile process is already a bit slower due to the network's inherent "lag", so adding more to the load is contraindicated unless it's absolutely necessary. :D
 
Excellent, Alexis, thank you very much!

I was looking under the online SDK php, where that note should have been, but there was no mention of it. Have now added it to the SDK folder.
 
Back
Top