General

Reply

Level 1

Level 1
tomatenbrei
Posts: 19
Registered: ‎10-09-2010
Message 1 of 2 (189 Views)
Accepted Solution

OutOfMemoryException by loading a xml-file

Hey everyone, I got a problem with loading xml files: As I load 16MB+ ones, I get an OutOfMemoryException. This is really annoying to me because I think that the vita should be able to handle 16MB files...

My code at the error part looks like this:

public Mapinformations_VITA DeserializeFromXML_VITA(string Filename)
        {
            FileStream fs = File.Open("/Application/" + Filename, FileMode.Open);
			
	    XmlSerializer deser = new XmlSerializer(typeof(Mapinformations_VITA));
            Mapinformations_VITA mapinfos = (Mapinformations_VITA) deser.Deserialize(fs); //ERROR!!
fs.Close(); return mapinfos; }
[Serializable]
    public class Mapinformations_VITA
    {
        [XmlElement("s")]
        public String s;
        [XmlElement("f")]
        public float f;
        [XmlElement("m")]
        public List<Mappic> m;
    }
    [Serializable]
    public class Mappic
    {
        [XmlElement("barray")]
        public byte[] barray;
        [XmlElement("x")]
        public int x;
        [XmlElement("y")]
        public int y;
        [XmlElement("layer")]
        public int layer;
    }

 Any advice would be greatly appreciated :smileyhappy:

Please use plain text.

Re: OutOfMemoryException by loading a xml-file

16MB is pretty big for an XML file, if I'm looking correctly at the way you're loading it you're also loading in the entire contents and then deserializing down to classes. I imagine this is using up 16MB just to store the XML and then additional memory for the actual classes that will hold it.

 

There is a 32MB memory limit by default set on the managed heap (and 64 for the resource heap). You might want to increase the heap size or look in to a more memory efficient way of loading your data.

 

file:///C:/Users/Public/Documents/Pss/doc/en/application_settings_en.html

Martin Caine
Founder and Lead Programmer of Retroburn Game Studios

Twitter | LinkedIn | Facebook
Please use plain text.
This widget could not be displayed.
Announcements

Welcome to the PlayStation Mobile Developer Forums


This is a community for the discussion of technical topics with other developers and SCE engineers. Posting ideas/requests are also appreciated. Join the discussion!

PlayStation®Mobile開発者フォーラムでは世界中の開発者の皆様と一緒に、議論や情報交換が可能です。SCEも議論に参加し、皆様の開発をサポートします。アイデアやリクエストも大歓迎です。ぜひご参加ください。

PSM Developer Registration (for free) on PSM DevPortal is required to post on the forum.
Please sign out then sign in again to the forum and PSM DevPortal after you have completed the registration.

フォーラムへ投稿をするにはPSM DevPortalへの登録(無料)が必要です。
登録後はフォーラムと PSM DevPortalを一度ログアウトし、再度ログインしてください。






Recent News