• 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.

System.OutOfMemoryException

Messages
64
Country
unitedkingdom
I've recently run into a problem where compiling an X file throws a System.OutOfMemoryException.
I'm using the P3D v1.4 XtoMDL.exe. The PC I'm using has 8Gb of RAM, or which 3.8Gb was available when compiling.

Any ideas what might be causing this?

Thanks
 
This is the full error message:


(0): error : XToMdl.exe Unhandled Application Exception
(0): error : System.OutOfMemoryException: Exception of type 'System.OutOfMemoryE
xception' 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, Int
32 count)
(0): error : at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flu
shEncoder)
(0): error : at System.IO.StreamWriter.Flush()
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.EndElement(B
oolean bIndent)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.StartElement
(String szElement, String[] Attributes, String[] AttributeValues, String Element
Contents)
(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.ExportIndexLis
t(FileExporter Exporter)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.Ex
portIndexList(FileExporter Exporter)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.WriteModelEn
try(String szDecoration, ModelProcessingContext Context)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.Ex
port(FileExporter Exporter)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.OutputModels
(IEnumerable ProcessedModels)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.OutputModels(IE
numerable`1 processedModels)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.Process(ModelFi
le[] InputFiles, Hashtable[] AnimationLinkage, String[] AnimationFileRef, XPartD
ict PartDictionary)
(0): error : at Microsoft.FlightSimulator.XToMDL.XToMDL.ProcessInputs()
(0): error : at Microsoft.FlightSimulator.XToMDL.XToMDL.RealMain(String[] arg
s)
(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, Int
32 count)
(0): error : at System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flu
shEncoder)
(0): error : at System.IO.StreamWriter.Flush()
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.EndElement(B
oolean bIndent)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.StartElement
(String szElement, String[] Attributes, String[] AttributeValues, String Element
Contents)
(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.ExportIndexLis
t(FileExporter Exporter)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.Ex
portIndexList(FileExporter Exporter)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.WriteModelEn
try(String szDecoration, ModelProcessingContext Context)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.ModelProcessingContext.Ex
port(FileExporter Exporter)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.FileExporter.OutputModels
(IEnumerable ProcessedModels)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.OutputModels(IE
numerable`1 processedModels)
(0): error : at Microsoft.FlightSimulator.XToXmlLib.XToXmlLib.Process(ModelFi
le[] InputFiles, Hashtable[] AnimationLinkage, String[] AnimationFileRef, XPartD
ict PartDictionary)
(0): error : at Microsoft.FlightSimulator.XToMDL.XToMDL.ProcessInputs()
(0): error : at Microsoft.FlightSimulator.XToMDL.XToMDL.RealMain(String[] arg
s)
(0): error : at Microsoft.FlightSimulator.XToMDL.XToMDL.Main(String[] args)
 
No I don't specifically but do be aware that Out Of Memory exceptions are rarely the result of actually running out of memory. The worst example I know (officially documented by the way) is that an out of memory exception gets thrown if a NET program tries to load a file that is not an image file as an image file.

OOMs are caused by running out of the memory available to the application - sometimes apps can't get more memory so when their bit is gone then pouf. Sometimes they get thrown when other resources like handles or graphic objects run out. I could go on but they are a PITA. The actual error occurred because the program was trying to set space to handle a memory stream (like a file in memory) and could not get what it needed. Was the file you were working with very large?
 
Thanks, Jon. Sounds like a tricky one to try and track down then!
The X file I'm trying to compile to and MDL is 71Mb. Is that getting into the realms where the tools can no longer cope?
 
It could well be. I have no idea but if you try with something smaller does that work?
 
I can compile smaller X files fine. However, a colleague with a less powerful machine can compile this same troublesome model with no problems.
 
Well that could be for all sorts of reasons. Perhaps you can try shutting down as many programs as possible and see if that helps. Given the amount of memory you have that may not help. I am sorry but diagnosing this is not an easy task. Clear your memory down and see if that helps. On www.koshyjohn.com is a program called Memory Cleaner. I use it all the time to clear out memory that is hanging about. It seems very reliable and I have not had any crashes after using it (famous last words!
 
Rich,

Get the new V2 SDK and use that for exporting from Max to X/Xanim. Then use the 1.4 version compiler to compile the X and Xanim files.

The old compiler had issues and legacy code in it. It has all been repaired in V2. You will need the V1 XtoMDL compiler though for making FSX/V1.4 models.

EDIT: Remember to have the same ModelDEF.XML file in both the V1 and V2 folders so you can properly export the models. Use one as your main 'edit' version and copy that to the other compiler 'bin' folder so you will never confuse then and accidentally overwrite a 'new' version. :S

Bill
LHC
 
Bill (Lionheart) is right in the fact that P3D 1.4 max plugins have legacy code issues. To bypass the out of memory error:
1) Use either P3D 1.4 or P3D 2.0 SDK 3ds max plugins. Be sure to check "Export ESP 1.0" for the model to work in FSX.
2) Then use the P3D 1.4 XtoMDL. Add the /writetofile command. This will store the XML file of the model into the hard drive instead of RAM, thus the "out of memory" error goes away.

Observations:
I've noticed that with .x files in the high 70MB range, XtoMDL gives this kind of issues. My F-4 MDL file was just below 39MB in the last good compile before the OOM error. This could be an indication of reaching the limit.
The XML file that is created during the proccess can easily go above 300MB, and for some reason XtoMDL feels it doesn't have enough RAM to use when getting there.
 
The XML file that is created during the proccess can easily go above 300MB, and for some reason XtoMDL feels it doesn't have enough RAM to use when getting there.
Alexis

Man, that's what I don't want to hear is limits. :S
 
There are though. And the /WRITETOFILE prompt is used to go around them, for complex models. You can find it in the P3D 1.4 SDK release notes.
 
Thanks, chaps.

Luckily we still have one PC that is still compiling the VC model. I've tried (what feels like) a hundred other PCs over the last week and none of them have worked. Seems more like a questions of why does it work on that one rather than why it doesn't work on all the rest.
Looks like it's time to dive into the P3Dv2 SDK then! Our modeller will certainly be happy to see the back of 3DS 2008!
 
Back
Top